Class: Hangry::ParserClassSelecter
- Inherits:
-
Object
- Object
- Hangry::ParserClassSelecter
- Defined in:
- lib/hangry/parser_class_selecter.rb
Instance Method Summary collapse
-
#initialize(html) ⇒ ParserClassSelecter
constructor
A new instance of ParserClassSelecter.
- #parser_class ⇒ Object
Constructor Details
#initialize(html) ⇒ ParserClassSelecter
Returns a new instance of ParserClassSelecter.
12 13 14 |
# File 'lib/hangry/parser_class_selecter.rb', line 12 def initialize(html) @html = html end |
Instance Method Details
#parser_class ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/hangry/parser_class_selecter.rb', line 16 def parser_class # Prefer the more specific parsers parser_classes = [ Parsers::NonStandard::AllRecipesParser, Parsers::NonStandard::EatingWellParser, Parsers::NonStandard::TasteOfHomeParser ] parser_classes += [SchemaOrgRecipeParser, HRecipeParser, DataVocabularyRecipeParser] parser_classes << DefaultRecipeParser parser_classes.detect { |p| p.can_parse?(@html) } end |