Class: Styler::Style
- Inherits:
-
Object
- Object
- Styler::Style
- Defined in:
- lib/styler/style.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#styles ⇒ Object
readonly
Returns the value of attribute styles.
Instance Method Summary collapse
- #-(other) ⇒ Object
- #==(other) ⇒ Object
-
#initialize(collection, name, styles = []) ⇒ Style
constructor
A new instance of Style.
- #to_a ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(collection, name, styles = []) ⇒ Style
Returns a new instance of Style.
4 5 6 7 8 |
# File 'lib/styler/style.rb', line 4 def initialize(collection, name, styles = []) @collection = collection @name = name @styles = styles end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
2 3 4 |
# File 'lib/styler/style.rb', line 2 def collection @collection end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
2 3 4 |
# File 'lib/styler/style.rb', line 2 def name @name end |
#styles ⇒ Object (readonly)
Returns the value of attribute styles.
2 3 4 |
# File 'lib/styler/style.rb', line 2 def styles @styles end |
Instance Method Details
#-(other) ⇒ Object
16 17 18 |
# File 'lib/styler/style.rb', line 16 def -(other) Styler::StyleSubstraction.new(self, other) end |
#==(other) ⇒ Object
10 11 12 13 14 |
# File 'lib/styler/style.rb', line 10 def ==(other) self.class == other.class && name == other.name && to_a == other.to_a end |
#to_a ⇒ Object
20 21 22 |
# File 'lib/styler/style.rb', line 20 def to_a styles.map(&:to_s) end |
#to_s ⇒ Object
24 25 26 |
# File 'lib/styler/style.rb', line 24 def to_s to_a.join(" ") end |