Class: Apropos::ClassList
- Inherits:
-
Object
- Object
- Apropos::ClassList
- Defined in:
- lib/apropos/class_list.rb
Overview
ClassList wraps a list of CSS class selectors with several abilities:
-
Can be combined with other ClassLists
-
Can be compared to MediaQuery or ClassList objects via #sort_value, #type
-
Can be converted to CSS output
Instance Attribute Summary collapse
-
#list ⇒ Object
readonly
Returns the value of attribute list.
-
#sort_value ⇒ Object
readonly
Returns the value of attribute sort_value.
Instance Method Summary collapse
- #combine(other) ⇒ Object
-
#initialize(list, sort_value = 0) ⇒ ClassList
constructor
A new instance of ClassList.
- #to_css ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(list, sort_value = 0) ⇒ ClassList
Returns a new instance of ClassList.
9 10 11 12 |
# File 'lib/apropos/class_list.rb', line 9 def initialize(list, sort_value=0) @list = list @sort_value = sort_value end |
Instance Attribute Details
#list ⇒ Object (readonly)
Returns the value of attribute list.
7 8 9 |
# File 'lib/apropos/class_list.rb', line 7 def list @list end |
#sort_value ⇒ Object (readonly)
Returns the value of attribute sort_value.
7 8 9 |
# File 'lib/apropos/class_list.rb', line 7 def sort_value @sort_value end |
Instance Method Details
#combine(other) ⇒ Object
14 15 16 |
# File 'lib/apropos/class_list.rb', line 14 def combine(other) self.class.new(list + other.list) end |
#to_css ⇒ Object
18 19 20 |
# File 'lib/apropos/class_list.rb', line 18 def to_css list.join(', ') end |
#type ⇒ Object
22 23 24 |
# File 'lib/apropos/class_list.rb', line 22 def type "class" end |