Class: CssParser::RuleSet::Declarations::Value

Inherits:
Object
  • Object
show all
Defined in:
lib/css_parser/rule_set.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, important: nil) ⇒ Value

Returns a new instance of Value.



40
41
42
43
# File 'lib/css_parser/rule_set.rb', line 40

def initialize(value, important: nil)
  self.value = value
  @important = important unless important.nil?
end

Instance Attribute Details

#importantObject

Returns the value of attribute important.



38
39
40
# File 'lib/css_parser/rule_set.rb', line 38

def important
  @important
end

#valueObject

Returns the value of attribute value.



37
38
39
# File 'lib/css_parser/rule_set.rb', line 37

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



58
59
60
61
62
# File 'lib/css_parser/rule_set.rb', line 58

def ==(other)
  return false unless other.is_a?(self.class)

  value == other.value && important == other.important
end

#to_sObject



54
55
56
# File 'lib/css_parser/rule_set.rb', line 54

def to_s
  important ? "#{value} !important" : value
end