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.
374 375 376 377 378 |
# File 'lib/mmmd/renderers/plainterm.rb', line 374 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.
380 381 382 |
# File 'lib/mmmd/renderers/plainterm.rb', line 380 def effect_priority @effect_priority end |
#style ⇒ Object (readonly)
Returns the value of attribute style.
380 381 382 |
# File 'lib/mmmd/renderers/plainterm.rb', line 380 def style @style end |
Class Method Details
.define_effect_priority(key, priority) ⇒ void
This method returns an undefined value.
Define an effect priority value
356 357 358 359 |
# File 'lib/mmmd/renderers/plainterm.rb', line 356 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
347 348 349 350 |
# File 'lib/mmmd/renderers/plainterm.rb', line 347 def define_style(key, style) @style ||= DEFAULT_STYLE.dup @style[key] = style end |
.effect_priority ⇒ Hash
Get computed effect priority
369 370 371 |
# File 'lib/mmmd/renderers/plainterm.rb', line 369 def effect_priority @effect_priority ||= DEFAULT_EFFECT_PRIORITY.dup end |
.style ⇒ Hash
Get computed style
363 364 365 |
# File 'lib/mmmd/renderers/plainterm.rb', line 363 def style @style ||= DEFAULT_STYLE.dup end |