Class: StyleStats::Css::Declaration

Inherits:
Object
  • Object
show all
Defined in:
lib/style_stats/css/declaration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(property, value) ⇒ Declaration

Returns a new instance of Declaration.



5
6
7
8
9
# File 'lib/style_stats/css/declaration.rb', line 5

def initialize(property, value)
  self.important = !!value.match(/!important/)
  self.property = property
  self.value = value.gsub("!important", '').strip.force_encoding("utf-8")
end

Instance Attribute Details

#importantObject

Returns the value of attribute important.



3
4
5
# File 'lib/style_stats/css/declaration.rb', line 3

def important
  @important
end

#propertyObject

Returns the value of attribute property.



3
4
5
# File 'lib/style_stats/css/declaration.rb', line 3

def property
  @property
end

#valueObject

Returns the value of attribute value.



3
4
5
# File 'lib/style_stats/css/declaration.rb', line 3

def value
  @value
end