Class: StyleInliner::DeclarationBlock

Inherits:
Object
  • Object
show all
Defined in:
lib/style_inliner/declaration_block.rb

Instance Method Summary collapse

Constructor Details

#initialize(rule_sets) ⇒ DeclarationBlock

Returns a new instance of DeclarationBlock.

Parameters:



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

Returns:

  • (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_sString

Returns:

  • (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