Class: Hangry::Parsers::NonStandard::TasteOfHomeParser
- Inherits:
-
HRecipeParser
- Object
- RecipeParser
- HRecipeParser
- Hangry::Parsers::NonStandard::TasteOfHomeParser
- Defined in:
- lib/hangry/parsers/non_standard/taste_of_home_parser.rb
Instance Attribute Summary
Attributes inherited from RecipeParser
#nokogiri_doc, #nutrition_ast, #recipe, #recipe_ast, #recipe_html
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from HRecipeParser
nutrition_selector, root_selector
Methods inherited from RecipeParser
canonical_url_matches_domain?, #initialize, #parse
Constructor Details
This class inherits a constructor from Hangry::RecipeParser
Class Method Details
.can_parse?(html) ⇒ Boolean
6 7 8 |
# File 'lib/hangry/parsers/non_standard/taste_of_home_parser.rb', line 6 def self.can_parse?(html) canonical_url_matches_domain?(html, 'tasteofhome.com') end |
Instance Method Details
#nodes_with_class(klass) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/hangry/parsers/non_standard/taste_of_home_parser.rb', line 10 def nodes_with_class(klass) super.reject { |node| # Taste of Home has nested elements with the 'ingredient' class. # So reject all nodes with a child that has the same class. node.css(".#{klass}").any? } end |