class Roadie::StyleProperty
@attr_reader [Integer] specificity specificity of parent {Selector}. Used to compare/sort.
@attr_reader [Boolean] important if the property is “!important”.
@attr_reader [String] value value of the property (such as “5px solid green”).
@attr_reader [String] property name of the property (such as “font-size”).
Domain object for a CSS property such as “color: red !important”.
@api private
def <=>(other)
Compare another {StyleProperty}. Important styles are "greater than"
def <=>(other) if important == other.important specificity <=> other.specificity else important ? 1 : -1 end end
def important?
def important? @important end
def initialize(property, value, important, specificity)
def initialize(property, value, important, specificity) @property = property @value = value @important = important @specificity = specificity end
def inspect
def inspect "#{to_s} (#{specificity})" end
def to_s
def to_s [property, value_with_important].join(':') end
def value_with_important
def value_with_important if important "#{value} !important" else value end end