class MenuMarkupParser::Item

Public Instance Methods

children() click to toggle source
# File lib/menu_markup_parser.rb, line 68
def children
  []
end

Private Instance Methods

parse_inline_price() click to toggle source
# File lib/menu_markup_parser.rb, line 89
def parse_inline_price
  match = MenuMarkup::ParsedPrice.find_match(description)
  if match
    [MenuMarkup::ParsedPrice.new(match.to_s)]
  else
    [MenuMarkup::ParsedPrice.new(nil)]
  end
end
parse_price_line() click to toggle source
# File lib/menu_markup_parser.rb, line 78
def parse_price_line
  new_description = description
  match = MenuMarkup::ParsedPrice.find_match(new_description, eop: /(?=$)/ui) || MenuMarkup::ParsedPrice.find_match(new_description, bop: /(?<=^)/ui)

  if match
    new_description.slice!(match.begin(0)...match.end(0))
    @description_lines = new_description.lines.collect(&:strip).reject(&:blank?)
    [MenuMarkup::ParsedPrice.new(match.to_s)]
  end
end
parse_prices!() click to toggle source
# File lib/menu_markup_parser.rb, line 74
def parse_prices!
  parse_explicit_prices.presence || parse_price_line.presence || parse_inline_price
end