Class: CSS::SAC::Conditions::CombinatorCondition
- Defined in:
- lib/css/sac/conditions/combinator_condition.rb
Instance Attribute Summary collapse
-
#first_condition ⇒ Object
(also: #first)
Returns the value of attribute first_condition.
-
#second_condition ⇒ Object
(also: #second)
Returns the value of attribute second_condition.
Attributes inherited from Condition
Instance Method Summary collapse
- #==(other) ⇒ Object
- #hash ⇒ Object
-
#initialize(first, second) ⇒ CombinatorCondition
constructor
A new instance of CombinatorCondition.
- #specificity ⇒ Object
- #to_css ⇒ Object
- #to_xpath ⇒ Object
Methods inherited from Condition
Methods included from Visitable
Constructor Details
#initialize(first, second) ⇒ CombinatorCondition
Returns a new instance of CombinatorCondition.
11 12 13 14 15 16 |
# File 'lib/css/sac/conditions/combinator_condition.rb', line 11 def initialize(first, second) super(:SAC_AND_CONDITION) @first_condition = first @second_condition = second end |
Instance Attribute Details
#first_condition ⇒ Object Also known as: first
Returns the value of attribute first_condition.
7 8 9 |
# File 'lib/css/sac/conditions/combinator_condition.rb', line 7 def first_condition @first_condition end |
#second_condition ⇒ Object Also known as: second
Returns the value of attribute second_condition.
7 8 9 |
# File 'lib/css/sac/conditions/combinator_condition.rb', line 7 def second_condition @second_condition end |
Instance Method Details
#==(other) ⇒ Object
30 31 32 |
# File 'lib/css/sac/conditions/combinator_condition.rb', line 30 def ==(other) super && first == other.first && second == other.second end |
#hash ⇒ Object
34 35 36 |
# File 'lib/css/sac/conditions/combinator_condition.rb', line 34 def hash [first, second].hash end |
#specificity ⇒ Object
26 27 28 |
# File 'lib/css/sac/conditions/combinator_condition.rb', line 26 def specificity first.specificity + second.specificity end |
#to_css ⇒ Object
18 19 20 |
# File 'lib/css/sac/conditions/combinator_condition.rb', line 18 def to_css "#{first.to_css}#{second.to_css}" end |
#to_xpath ⇒ Object
22 23 24 |
# File 'lib/css/sac/conditions/combinator_condition.rb', line 22 def to_xpath "#{first.to_xpath}#{second.to_xpath}" end |