Class: RSAC::StyleSheet::Rule
- Inherits:
-
Object
- Object
- RSAC::StyleSheet::Rule
- Includes:
- Comparable
- Defined in:
- lib/antisamy/csspool/rsac/stylesheet/rule.rb
Instance Attribute Summary collapse
-
#index ⇒ Object
Returns the value of attribute index.
-
#properties ⇒ Object
Returns the value of attribute properties.
-
#selector ⇒ Object
Returns the value of attribute selector.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(selector, index, properties = []) ⇒ Rule
constructor
A new instance of Rule.
Constructor Details
#initialize(selector, index, properties = []) ⇒ Rule
Returns a new instance of Rule.
8 9 10 11 12 |
# File 'lib/antisamy/csspool/rsac/stylesheet/rule.rb', line 8 def initialize(selector, index, properties = []) @selector = selector @properties = Set.new(properties) @index = index end |
Instance Attribute Details
#index ⇒ Object
Returns the value of attribute index.
7 8 9 |
# File 'lib/antisamy/csspool/rsac/stylesheet/rule.rb', line 7 def index @index end |
#properties ⇒ Object
Returns the value of attribute properties.
7 8 9 |
# File 'lib/antisamy/csspool/rsac/stylesheet/rule.rb', line 7 def properties @properties end |
#selector ⇒ Object
Returns the value of attribute selector.
7 8 9 |
# File 'lib/antisamy/csspool/rsac/stylesheet/rule.rb', line 7 def selector @selector end |
Instance Method Details
#<=>(other) ⇒ Object
14 15 16 17 |
# File 'lib/antisamy/csspool/rsac/stylesheet/rule.rb', line 14 def <=>(other) comp = selector.specificity <=> other.selector.specificity comp == 0 ? index <=> other.index : comp end |