Class: Goat::Config
Instance Method Summary collapse
- #[](k) ⇒ Object
- #[]=(k, v) ⇒ Object
- #add_component_helpers(modul) ⇒ Object
- #enable_mongo(opts = {}) ⇒ Object
- #enable_notifications(opts = {}) ⇒ Object
- #enable_statesrv(opts = {}) ⇒ Object
- #get!(opt) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
74 75 76 |
# File 'lib/goat.rb', line 74 def initialize @config = {} end |
Instance Method Details
#[](k) ⇒ Object
102 |
# File 'lib/goat.rb', line 102 def [](k); @config[k]; end |
#[]=(k, v) ⇒ Object
103 104 105 106 107 108 109 110 |
# File 'lib/goat.rb', line 103 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
98 99 100 |
# File 'lib/goat.rb', line 98 def add_component_helpers(modul) Goat::Component.send(:include, modul) end |
#enable_mongo(opts = {}) ⇒ Object
86 87 88 |
# File 'lib/goat.rb', line 86 def enable_mongo(opts={}) require Goat.goat_path('mongo') end |
#enable_notifications(opts = {}) ⇒ Object
78 79 80 |
# File 'lib/goat.rb', line 78 def enable_notifications(opts={}) NotificationCenter.configure(opts) end |
#enable_statesrv(opts = {}) ⇒ Object
82 83 84 |
# File 'lib/goat.rb', line 82 def enable_statesrv(opts={}) StateSrvClient.configure(opts) end |
#get!(opt) ⇒ Object
90 91 92 93 94 95 96 |
# File 'lib/goat.rb', line 90 def get!(opt) if @config.include?(opt) @config[opt] else raise "#{opt} not set" end end |