Class: MMMD::Renderers::HTMLConstants::MapManager

Inherits:
Object
  • Object
show all
Defined in:
lib/mmmd/renderers/html.rb

Overview

Class for managing styles and style overrides

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(overrides) ⇒ MapManager

Returns a new instance of MapManager.



127
128
129
130
# File 'lib/mmmd/renderers/html.rb', line 127

def initialize(overrides)
  @mapping = self.class.mapping
  @mapping = @mapping.merge(overrides["mapping"]) if overrides["mapping"]
end

Instance Attribute Details

#mappingObject (readonly)

Returns the value of attribute mapping.



132
133
134
# File 'lib/mmmd/renderers/html.rb', line 132

def mapping
  @mapping
end

Class Method Details

.define_mapping(key, mapping) ⇒ void

This method returns an undefined value.

Define a default mapping for specified class

Parameters:

  • key (String)

    class name

  • mapping (Hash)

    mapping



115
116
117
118
# File 'lib/mmmd/renderers/html.rb', line 115

def define_mapping(key, mapping)
  @mapping ||= ELEMENT_MAP.dup
  @mapping[key] = mapping
end

.mappingHash

Get computed mapping

Returns:

  • (Hash)


122
123
124
# File 'lib/mmmd/renderers/html.rb', line 122

def mapping
  @mapping ||= ELEMENT_MAP.dup
end