class StyleInliner::RuleSet
Constants
- PATTERN
Attributes
declarations[R]
specificity[R]
Public Class Methods
decode(source)
click to toggle source
@param source [String]
# File lib/style_inliner/rule_set.rb, line 10 def decode(source) source.scan(PATTERN).map do |specificity, declarations| new( declarations: declarations, specificity: specificity.to_i, ) end end
new(declarations:, specificity:)
click to toggle source
@param specificity [Integer] e.g. `1` @param declarations [String] e.g. `“background: red; color: yellow;”`
# File lib/style_inliner/rule_set.rb, line 22 def initialize(declarations:, specificity:) @declarations = declarations @specificity = specificity end
Public Instance Methods
encode()
click to toggle source
@return [String]
# File lib/style_inliner/rule_set.rb, line 28 def encode "[SPEC=#{@specificity}[#{@declarations}]]" end