class Hatemile::Util::Css::Rcp::RCPRule
The RCPRule
class is official implementation of Hatemile::Util::Css::StyleSheetRule
for Ruby CSS Parser.
Public Class Methods
new(rule)
click to toggle source
Initializes a new object that encapsulate the Ruby CSS Parser rule.
@param rule [CssParser::RuleSet] The Ruby CSS Parser rule.
# File lib/hatemile/util/css/rcp/rcp_rule.rb, line 43 def initialize(rule) Hatemile::Helper.require_not_nil(rule) Hatemile::Helper.require_valid_type(rule, CssParser::RuleSet) @rule = rule end
Public Instance Methods
get_declarations(property_name)
click to toggle source
@see Hatemile::Util::Css::StyleSheetRule#get_declarations
# File lib/hatemile/util/css/rcp/rcp_rule.rb, line 67 def get_declarations(property_name) declarations = [] @rule.each_declaration do |property, value, _important| if property == property_name declarations.push(RCPDeclaration.new(property, value)) end end declarations end
get_selector()
click to toggle source
@see Hatemile::Util::Css::StyleSheetRule#get_selector
# File lib/hatemile/util/css/rcp/rcp_rule.rb, line 79 def get_selector @rule.selectors.join(', ') end
has_declarations?()
click to toggle source
@see Hatemile::Util::Css::StyleSheetRule#has_declarations?
# File lib/hatemile/util/css/rcp/rcp_rule.rb, line 61 def has_declarations? true end
has_property?(property_name)
click to toggle source
@see Hatemile::Util::Css::StyleSheetRule#has_property?
# File lib/hatemile/util/css/rcp/rcp_rule.rb, line 52 def has_property?(property_name) @rule.each_declaration do |property, _value, _important| return true if property == property_name end false end