Class: StyleInliner::DeclarationBlock
- Inherits:
-
Object
- Object
- StyleInliner::DeclarationBlock
- Defined in:
- lib/style_inliner/declaration_block.rb
Instance Method Summary collapse
- #delete_property(property_name) ⇒ Object
- #get_property(property_name) ⇒ String
-
#initialize(rule_sets) ⇒ DeclarationBlock
constructor
A new instance of DeclarationBlock.
- #to_s ⇒ String
Constructor Details
#initialize(rule_sets) ⇒ DeclarationBlock
Returns a new instance of DeclarationBlock.
4 5 6 |
# File 'lib/style_inliner/declaration_block.rb', line 4 def initialize(rule_sets) @rule_sets = rule_sets end |
Instance Method Details
#delete_property(property_name) ⇒ Object
8 9 10 |
# File 'lib/style_inliner/declaration_block.rb', line 8 def delete_property(property_name) merged_rule_set.instance_variable_get(:@declarations).delete(property_name) end |
#get_property(property_name) ⇒ String
13 14 15 |
# File 'lib/style_inliner/declaration_block.rb', line 13 def get_property(property_name) merged_rule_set[property_name] end |
#to_s ⇒ String
18 19 20 |
# File 'lib/style_inliner/declaration_block.rb', line 18 def to_s merged_rule_set.declarations_to_s.gsub('"', "'").split(/;(?![^(]*\))/).map(&:strip).sort.join("; ") end |