Class: MMMD::Renderers::PlaintermConstants::StyleManager
- Inherits:
-
Object
- Object
- MMMD::Renderers::PlaintermConstants::StyleManager
- Defined in:
- lib/mmmd/renderers/plainterm.rb
Overview
Class for managing styles and style overrides
Instance Attribute Summary collapse
-
#effect_priority ⇒ Object
readonly
Returns the value of attribute effect_priority.
-
#style ⇒ Object
readonly
Returns the value of attribute style.
Class Method Summary collapse
-
.define_effect_priority(key, priority) ⇒ void
Define an effect priority value.
-
.define_style(key, style) ⇒ void
Define a default style for specified class.
-
.effect_priority ⇒ Hash
Get computed effect priority.
-
.style ⇒ Hash
Get computed style.
Instance Method Summary collapse
-
#initialize(overrides) ⇒ StyleManager
constructor
A new instance of StyleManager.
Constructor Details
#initialize(overrides) ⇒ StyleManager
Returns a new instance of StyleManager.
381 382 383 384 385 |
# File 'lib/mmmd/renderers/plainterm.rb', line 381 def initialize(overrides) @style = self.class.style @effect_priority = self.class.effect_priority @style = @style.merge(overrides["style"]) if overrides["style"] end |
Instance Attribute Details
#effect_priority ⇒ Object (readonly)
Returns the value of attribute effect_priority.
387 388 389 |
# File 'lib/mmmd/renderers/plainterm.rb', line 387 def effect_priority @effect_priority end |
#style ⇒ Object (readonly)
Returns the value of attribute style.
387 388 389 |
# File 'lib/mmmd/renderers/plainterm.rb', line 387 def style @style end |
Class Method Details
.define_effect_priority(key, priority) ⇒ void
This method returns an undefined value.
Define an effect priority value
363 364 365 366 |
# File 'lib/mmmd/renderers/plainterm.rb', line 363 def define_effect_priority(key, priority) @effect_priority ||= DEFAULT_EFFECT_PRIORITY.dup @effect_priority[key] = priority end |
.define_style(key, style) ⇒ void
This method returns an undefined value.
Define a default style for specified class
354 355 356 357 |
# File 'lib/mmmd/renderers/plainterm.rb', line 354 def define_style(key, style) @style ||= DEFAULT_STYLE.dup @style[key] = style end |
.effect_priority ⇒ Hash
Get computed effect priority
376 377 378 |
# File 'lib/mmmd/renderers/plainterm.rb', line 376 def effect_priority @effect_priority ||= DEFAULT_EFFECT_PRIORITY.dup end |
.style ⇒ Hash
Get computed style
370 371 372 |
# File 'lib/mmmd/renderers/plainterm.rb', line 370 def style @style ||= DEFAULT_STYLE.dup end |