Class: Watchmaker::Configuration

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/watchmaker/configuration.rb

Overview

Singleton configuration class to hold all configured information.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Initialize to an empty hash.



19
20
21
# File 'lib/watchmaker/configuration.rb', line 19

def initialize 
  @profiles = {}
end

Instance Attribute Details

#profilesObject

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?

Returns:

  • (Boolean)


36
37
38
# File 'lib/watchmaker/configuration.rb', line 36

def defined?(name)
  !!defined(name)
end

.learnObject



28
29
30
# File 'lib/watchmaker/configuration.rb', line 28

def define(name, dependencies, &block) 
  instance.define(name, dependencies, &block)
end

.learnedObject



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