Class: Watchmaker::Configuration
- Inherits:
-
Object
- Object
- Watchmaker::Configuration
- Includes:
- Singleton
- Defined in:
- lib/watchmaker/configuration.rb
Overview
Singleton configuration class to hold all configured information.
Instance Attribute Summary collapse
-
#profiles ⇒ Object
Store list of all profiles.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
Initialize to an empty hash.
-
#learn(name, dependencies, &block) ⇒ Object
:nodoc:.
-
#learned(name) ⇒ Object
:nodoc:.
Constructor Details
#initialize ⇒ Configuration
Initialize to an empty hash.
19 20 21 |
# File 'lib/watchmaker/configuration.rb', line 19 def initialize @profiles = {} end |
Instance Attribute Details
#profiles ⇒ Object
Store list of all profiles.
15 16 17 |
# File 'lib/watchmaker/configuration.rb', line 15 def profiles @profiles end |
Class Method Details
.learn(name, dependencies, &block) ⇒ Object
23 24 25 |
# File 'lib/watchmaker/configuration.rb', line 23 def self.learn(name, dependencies, &block) instance.learn(name, dependencies, &block) end |
.learned(name) ⇒ Object
27 28 29 |
# File 'lib/watchmaker/configuration.rb', line 27 def self.learned(name) instance.learned(name) end |
.learned?(name) ⇒ Boolean
31 32 33 |
# File 'lib/watchmaker/configuration.rb', line 31 def self.learned?(name) !!learned(name) end |
Instance Method Details
#learn(name, dependencies, &block) ⇒ Object
:nodoc:
35 36 37 38 39 40 |
# File 'lib/watchmaker/configuration.rb', line 35 def learn(name, dependencies, &block) # :nodoc: @profiles[name] = { :dependencies => dependencies, :block => block } end |
#learned(name) ⇒ Object
:nodoc:
42 43 44 |
# File 'lib/watchmaker/configuration.rb', line 42 def learned(name) # :nodoc: @profiles[name] end |