Class: Goat::Config

Inherits:
Object show all
Defined in:
lib/goat.rb

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



75
76
77
# File 'lib/goat.rb', line 75

def initialize
  @config = {}
end

Instance Method Details

#[](k) ⇒ Object



103
# File 'lib/goat.rb', line 103

def [](k); @config[k]; end

#[]=(k, v) ⇒ Object



104
105
106
107
108
109
110
111
# File 'lib/goat.rb', line 104

def []=(k, v)
  @config[k] = v

  meth = "enable_#{k}".to_sym
  if self.respond_to?(meth)
    self.send(meth, v)
  end
end

#add_component_helpers(modul) ⇒ Object



99
100
101
# File 'lib/goat.rb', line 99

def add_component_helpers(modul)
  Goat::Component.send(:include, modul)
end

#enable_mongo(opts = {}) ⇒ Object



87
88
89
# File 'lib/goat.rb', line 87

def enable_mongo(opts={})
  require Goat.goat_path('mongo')
end

#enable_notifications(opts = {}) ⇒ Object



79
80
81
# File 'lib/goat.rb', line 79

def enable_notifications(opts={})
  NotificationCenter.configure(opts)
end

#enable_statesrv(opts = {}) ⇒ Object



83
84
85
# File 'lib/goat.rb', line 83

def enable_statesrv(opts={})
  StateSrvClient.configure(opts)
end

#get!(opt) ⇒ Object



91
92
93
94
95
96
97
# File 'lib/goat.rb', line 91

def get!(opt)
  if @config.include?(opt)
    @config[opt]
  else
    raise "#{opt} not set"
  end
end