Class: FoodFishParser::Strict::Parser
- Inherits:
-
Object
- Object
- FoodFishParser::Strict::Parser
- Defined in:
- lib/food_fish_parser/strict/parser.rb
Instance Attribute Summary collapse
-
#parser ⇒ Object
readonly
Returns the value of attribute parser.
Instance Method Summary collapse
-
#initialize ⇒ FoodFishParser::Strict::Parser
constructor
Create a new fish detail parser.
-
#parse(s, anywhere: false, **options) ⇒ FoodFishParser::Strict::Grammar::RootNode
Parse food fish text into a structured representation.
Constructor Details
#initialize ⇒ FoodFishParser::Strict::Parser
Create a new fish detail parser
14 15 16 |
# File 'lib/food_fish_parser/strict/parser.rb', line 14 def initialize @parser = Grammar::RootParser.new end |
Instance Attribute Details
#parser ⇒ Object (readonly)
Returns the value of attribute parser.
10 11 12 |
# File 'lib/food_fish_parser/strict/parser.rb', line 10 def parser @parser end |
Instance Method Details
#parse(s, anywhere: false, **options) ⇒ FoodFishParser::Strict::Grammar::RootNode
Note:
Unrecognized options are passed to Treetop, but this is not guarenteed to remain so forever.
Parse food fish text into a structured representation.
24 25 26 27 28 29 30 |
# File 'lib/food_fish_parser/strict/parser.rb', line 24 def parse(s, anywhere: false, **) if anywhere = .merge(root: :root_anywhere, consume_all_input: false) end @parser.parse(s, **) end |