module AMarmita::Meals
Constants
- DESSERT
Public Instance Methods
get_date_and_week_number_from_javascript_function(javascript_function)
click to toggle source
# File lib/a_marmita/meals/base.rb, line 55 def get_date_and_week_number_from_javascript_function(javascript_function) args = javascript_function[(javascript_function.index('(') + 1)..-2].split(',') { date: args[0..2].join('-'), week_number: args[3] } end
get_description()
click to toggle source
# File lib/a_marmita/meals/scrapper.rb, line 39 def get_description get_xml_value css_parser.css('.em_ingredientes').last end
get_name()
click to toggle source
# File lib/a_marmita/meals/scrapper.rb, line 25 def get_name get_xml_value css_parser.css('.em_nomeprato').first end
get_price()
click to toggle source
# File lib/a_marmita/meals/scrapper.rb, line 35 def get_price get_xml_value css_parser.css('.em_preco').first end
get_type()
click to toggle source
# File lib/a_marmita/meals/scrapper.rb, line 29 def get_type get_xml_value(css_parser.css('.em_tipoprato > img').first) do |xml_object| xml_object.attr('src') end end
parse_links(page)
click to toggle source
# File lib/a_marmita/meals/base.rb, line 44 def parse_links(page) page.links.inject([]) do |links, link| links << get_date_and_week_number_from_javascript_function(link.href) if link.href.include?('em_setday') links end end
parse_meals(content_rows)
click to toggle source
# File lib/a_marmita/meals/base.rb, line 51 def parse_meals(content_rows) content_rows.map { |row| Meals::Scrapper.new(row).scrap }.compact end