class Solargraph::CodeMap

def phrase_at index

Returns:
  • (String) -

Parameters:
  • index (Integer) --
def phrase_at index
  word = ''
  cursor = index - 1
  while cursor > -1
    char = @code[cursor, 1]
    break if char.nil? or char == ''
    break unless char.match(/[\s;=\(\)\[\]\{\}]/).nil?
    word = char + word
    cursor -= 1
  end
  word
end