Class: Roadie::Inliner::StyleMap Private

Inherits:
Object
  • Object
show all
Defined in:
lib/roadie/inliner.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

StyleMap is a map between a DOM element and StyleAttributeBuilder. Basically, it’s an accumulator for properties, scoped on specific elements.

Instance Method Summary collapse

Constructor Details

#initializeStyleMap

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of StyleMap.



83
84
85
86
87
# File 'lib/roadie/inliner.rb', line 83

def initialize
  @map = Hash.new { |hash, key|
    hash[key] = StyleAttributeBuilder.new
  }
end

Instance Method Details

#add(elements, new_properties) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



89
90
91
92
93
94
95
# File 'lib/roadie/inliner.rb', line 89

def add(elements, new_properties)
  Array(elements).each do |element|
    new_properties.each do |property|
      @map[element] << property
    end
  end
end

#each_elementObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



97
98
99
# File 'lib/roadie/inliner.rb', line 97

def each_element
  @map.each_pair { |element, builder| yield element, builder }
end