class CssParser::RuleSet::Declarations::Value
Attributes
Public Class Methods
Source
# File lib/css_parser/rule_set.rb, line 42 def initialize(value, important: nil) self.value = value @important = important unless important.nil? end
Public Instance Methods
Source
# File lib/css_parser/rule_set.rb, line 60 def ==(other) return false unless other.is_a?(self.class) value == other.value && important == other.important end
Source
# File lib/css_parser/rule_set.rb, line 56 def to_s important ? "#{value} !important" : value end
Source
# File lib/css_parser/rule_set.rb, line 47 def value=(value) value = value.to_s.sub(/\s*;\s*\Z/, '') self.important = !value.slice!(CssParser::IMPORTANT_IN_PROPERTY_RX).nil? value.strip! raise ArgumentError, 'value is empty' if value.empty? @value = value.freeze end