Class: Aranha::Parsers::Html::Node::Base
- Inherits:
-
Object
- Object
- Aranha::Parsers::Html::Node::Base
- Defined in:
- lib/aranha/parsers/html/node/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
Instance Method Summary collapse
-
#initialize(fields) ⇒ Base
constructor
A new instance of Base.
- #parse(node) ⇒ Object
Constructor Details
#initialize(fields) ⇒ Base
Returns a new instance of Base.
10 11 12 |
# File 'lib/aranha/parsers/html/node/base.rb', line 10 def initialize(fields) @fields = fields end |
Instance Attribute Details
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
8 9 10 |
# File 'lib/aranha/parsers/html/node/base.rb', line 8 def fields @fields end |
Instance Method Details
#parse(node) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/aranha/parsers/html/node/base.rb', line 14 def parse(node) fields.to_h do |f| [f[0], parse_field(node, f[2], f[1])] rescue StandardError => e raise StandardError, "#{e.}\nFields: #{f}" end end |