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
- .define(name, dependencies, &block) ⇒ Object
- .defined(name) ⇒ Object
- .defined?(name) ⇒ Boolean (also: learned?)
- .learn ⇒ Object
- .learned ⇒ Object
Instance Method Summary collapse
-
#define(name, dependencies, &block) ⇒ Object
(also: #learn)
:nodoc:.
-
#defined(name) ⇒ Object
(also: #learned)
:nodoc:.
-
#initialize ⇒ Configuration
constructor
Initialize to an empty hash.
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
.define(name, dependencies, &block) ⇒ Object
24 25 26 |
# File 'lib/watchmaker/configuration.rb', line 24 def define(name, dependencies, &block) instance.define(name, dependencies, &block) end |
.defined(name) ⇒ Object
30 31 32 |
# File 'lib/watchmaker/configuration.rb', line 30 def defined(name) instance.defined(name) end |
.defined?(name) ⇒ Boolean Also known as: learned?
36 37 38 |
# File 'lib/watchmaker/configuration.rb', line 36 def defined?(name) !!defined(name) end |
.learn ⇒ Object
28 29 30 |
# File 'lib/watchmaker/configuration.rb', line 28 def define(name, dependencies, &block) instance.define(name, dependencies, &block) end |
.learned ⇒ Object
34 35 36 |
# File 'lib/watchmaker/configuration.rb', line 34 def defined(name) instance.defined(name) end |
Instance Method Details
#define(name, dependencies, &block) ⇒ Object Also known as: learn
:nodoc:
43 44 45 46 47 48 |
# File 'lib/watchmaker/configuration.rb', line 43 def define(name, dependencies, &block) # :nodoc: @profiles[name] = { :dependencies => dependencies, :block => block } end |
#defined(name) ⇒ Object Also known as: learned
:nodoc:
52 53 54 |
# File 'lib/watchmaker/configuration.rb', line 52 def defined(name) # :nodoc: @profiles[name] end |