Class: Roadie::Inliner::StyleMap Private
- Inherits:
-
Object
- Object
- Roadie::Inliner::StyleMap
- 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
- #add(elements, new_properties) ⇒ Object private
- #each_element(&block) ⇒ Object private
-
#initialize ⇒ StyleMap
constructor
private
A new instance of StyleMap.
Constructor Details
#initialize ⇒ StyleMap
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.
189 190 191 192 193 |
# File 'lib/roadie/inliner.rb', line 189 def initialize @map = Hash.new do |hash, key| hash[key] = StyleAttributeBuilder.new end 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.
195 196 197 198 199 200 201 |
# File 'lib/roadie/inliner.rb', line 195 def add(elements, new_properties) Array(elements).each do |element| new_properties.each do |property| @map[element] << property end end end |
#each_element(&block) ⇒ 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.
203 204 205 |
# File 'lib/roadie/inliner.rb', line 203 def each_element(&block) @map.each_pair(&block) end |