Class: Talius::Node::Att

Inherits:
Talius::Node show all
Defined in:
lib/talius.rb

Overview

This class inherits from Talius::Node and adds the value property.

Instance Attribute Summary collapse

Attributes inherited from Talius::Node

#name, #namespace

Instance Method Summary collapse

Methods inherited from Talius::Node

#full_name, #inspect, #to_s

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

#valueObject

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_hObject

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