Class: Talius::Node::Att
- Inherits:
-
Talius::Node
- Object
- Talius::Node
- Talius::Node::Att
- Defined in:
- lib/talius.rb
Overview
This class inherits from Talius::Node and adds the value property.
Instance Attribute Summary collapse
-
#value ⇒ Object
The value of the attribute rule, if there is one.
Attributes inherited from Talius::Node
Instance Method Summary collapse
-
#initialize(*opts) ⇒ Att
constructor
————————————————————————— initialize.
-
#to_h ⇒ Object
Returns a hash representation of the object.
Methods inherited from Talius::Node
Constructor Details
#initialize(*opts) ⇒ Att
initialize
690 691 692 693 |
# File 'lib/talius.rb', line 690 def initialize(*opts) super(*opts) @value = nil end |
Instance Attribute Details
#value ⇒ Object
The value of the attribute rule, if there is one.
raw = 'a[href][rel=parent]'
selector = Talius.new(raw)
rule = selector.rules[0]
rule.atts['href'].value # => nil
rule.atts['rel'].value # => "parent"
711 712 713 |
# File 'lib/talius.rb', line 711 def value @value end |
Instance Method Details
#to_h ⇒ Object
Returns a hash representation of the object.
723 724 725 726 727 728 729 730 731 732 |
# File 'lib/talius.rb', line 723 def to_h rv = super() # value if @value rv['value'] = @value end return rv end |