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.
10 11 12 |
# File 'lib/hangry/parser_class_selecter.rb', line 10 def initialize(html) @html = html end |
Instance Method Details
#parser_class ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/hangry/parser_class_selecter.rb', line 14 def parser_class # Prefer the more specific parsers parser_classes = [Parsers::NonStandard::AllRecipesParser] parser_classes += [SchemaOrgRecipeParser, HRecipeParser, DataVocabularyRecipeParser] parser_classes << DefaultRecipeParser parser_classes.detect { |p| p.can_parse?(@html) } end |