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.



34
35
36
37
# File 'lib/css_parser/rule_set.rb', line 34

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

Instance Attribute Details

#importantObject

Returns the value of attribute important.



32
33
34
# File 'lib/css_parser/rule_set.rb', line 32

def important
  @important
end

#valueObject

Returns the value of attribute value.



31
32
33
# File 'lib/css_parser/rule_set.rb', line 31

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



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

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

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

#to_sObject



48
49
50
# File 'lib/css_parser/rule_set.rb', line 48

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