Class: Gloss::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/gloss/parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(str) ⇒ Parser

Returns a new instance of Parser.



8
9
10
# File 'lib/gloss/parser.rb', line 8

def initialize(str)
  @str = str
end

Instance Method Details

#runObject



11
12
13
14
15
16
17
18
# File 'lib/gloss/parser.rb', line 11

def run()
  tree_json = Gloss.parse_buffer(@str)
  begin
    JSON.parse(tree_json, symbolize_names: true)
  rescue JSON::ParserError
    raise(Errors::ParserError, tree_json)
  end
end