Class: RSAC::Conditions::CombinatorCondition
- Defined in:
- lib/antisamy/csspool/rsac/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
Constructor Details
#initialize(first, second) ⇒ CombinatorCondition
Returns a new instance of CombinatorCondition.
8 9 10 11 12 13 |
# File 'lib/antisamy/csspool/rsac/sac/conditions/combinator_condition.rb', line 8 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.
4 5 6 |
# File 'lib/antisamy/csspool/rsac/sac/conditions/combinator_condition.rb', line 4 def first_condition @first_condition end |
#second_condition ⇒ Object Also known as: second
Returns the value of attribute second_condition.
4 5 6 |
# File 'lib/antisamy/csspool/rsac/sac/conditions/combinator_condition.rb', line 4 def second_condition @second_condition end |
Instance Method Details
#==(other) ⇒ Object
27 28 29 |
# File 'lib/antisamy/csspool/rsac/sac/conditions/combinator_condition.rb', line 27 def ==(other) super && first == other.first && second == other.second end |
#hash ⇒ Object
31 32 33 |
# File 'lib/antisamy/csspool/rsac/sac/conditions/combinator_condition.rb', line 31 def hash [first, second].hash end |
#specificity ⇒ Object
23 24 25 |
# File 'lib/antisamy/csspool/rsac/sac/conditions/combinator_condition.rb', line 23 def specificity first.specificity.zip(second.specificity).map { |x,y| x + y } end |
#to_css ⇒ Object
15 16 17 |
# File 'lib/antisamy/csspool/rsac/sac/conditions/combinator_condition.rb', line 15 def to_css "#{first.to_css}#{second.to_css}" end |
#to_xpath ⇒ Object
19 20 21 |
# File 'lib/antisamy/csspool/rsac/sac/conditions/combinator_condition.rb', line 19 def to_xpath "#{first.to_xpath}#{second.to_xpath}" end |