Class: FoodIngredientParser::Strict::Grammar::RootNode

Inherits:
SyntaxNode
  • Object
show all
Includes:
ToHtml
Defined in:
lib/food_ingredient_parser/strict/nodes.rb

Overview

Root object, contains everything else.

Instance Method Summary collapse

Methods included from ToHtml

#to_html

Instance Method Details

#to_hObject



25
26
27
28
29
30
31
# File 'lib/food_ingredient_parser/strict/nodes.rb', line 25

def to_h
  h = { contains: contains.to_a }
  if notes && notes_ary = to_a_deep(notes, NoteNode)&.map(&:text_value)
    h[:notes] = notes_ary if notes_ary.length > 0
  end
  h
end