Class: Styler::Style

Inherits:
Object
  • Object
show all
Defined in:
lib/styler/style.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#collectionObject (readonly)

Returns the value of attribute collection.



2
3
4
# File 'lib/styler/style.rb', line 2

def collection
  @collection
end

#nameObject (readonly)

Returns the value of attribute name.



2
3
4
# File 'lib/styler/style.rb', line 2

def name
  @name
end

#stylesObject (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_aObject



20
21
22
# File 'lib/styler/style.rb', line 20

def to_a
  styles.map(&:to_s)
end

#to_sObject



24
25
26
# File 'lib/styler/style.rb', line 24

def to_s
  to_a.join(" ")
end