Class: Taski::Progress::Config
- Inherits:
-
Object
- Object
- Taski::Progress::Config
- Defined in:
- lib/taski/progress/config.rb
Overview
Configuration for progress display. Holds class references for Layout and Theme, and builds display instances lazily.
Instance Attribute Summary collapse
-
#layout ⇒ Object
Returns the value of attribute layout.
-
#output ⇒ Object
Returns the value of attribute output.
-
#theme ⇒ Object
Returns the value of attribute theme.
Instance Method Summary collapse
-
#build ⇒ Object
Build a Layout instance from the current config.
-
#initialize(&on_invalidate) ⇒ Config
constructor
A new instance of Config.
-
#reset ⇒ Object
Reset all settings to defaults.
Constructor Details
#initialize(&on_invalidate) ⇒ Config
Returns a new instance of Config.
15 16 17 18 19 20 21 |
# File 'lib/taski/progress/config.rb', line 15 def initialize(&on_invalidate) @layout = nil @theme = nil @output = nil @cached_display = nil @on_invalidate = on_invalidate end |
Instance Attribute Details
#layout ⇒ Object
Returns the value of attribute layout.
12 13 14 |
# File 'lib/taski/progress/config.rb', line 12 def layout @layout end |
#output ⇒ Object
Returns the value of attribute output.
12 13 14 |
# File 'lib/taski/progress/config.rb', line 12 def output @output end |
#theme ⇒ Object
Returns the value of attribute theme.
12 13 14 |
# File 'lib/taski/progress/config.rb', line 12 def theme @theme end |
Instance Method Details
#build ⇒ Object
Build a Layout instance from the current config. Returns a cached instance if config hasn't changed.
42 43 44 |
# File 'lib/taski/progress/config.rb', line 42 def build @cached_display ||= build_display end |
#reset ⇒ Object
Reset all settings to defaults.
47 48 49 50 51 52 |
# File 'lib/taski/progress/config.rb', line 47 def reset @layout = nil @theme = nil @output = nil invalidate! end |