Class: LHC::Config
Instance Method Summary collapse
- #endpoint(name, url, options = {}) ⇒ Object
- #endpoints ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #interceptors ⇒ Object
- #interceptors=(interceptors) ⇒ Object
- #placeholder(name, value) ⇒ Object
- #placeholders ⇒ Object
- #reset ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
6 7 8 9 |
# File 'lib/lhc/config.rb', line 6 def initialize @endpoints = {} @placeholders = {} end |
Instance Method Details
#endpoint(name, url, options = {}) ⇒ Object
11 12 13 14 15 |
# File 'lib/lhc/config.rb', line 11 def endpoint(name, url, = {}) name = name.to_sym raise 'Endpoint already exists for that name' if @endpoints[name] @endpoints[name] = LHC::Endpoint.new(url, ) end |
#endpoints ⇒ Object
17 18 19 |
# File 'lib/lhc/config.rb', line 17 def endpoints @endpoints.dup end |
#interceptors ⇒ Object
31 32 33 |
# File 'lib/lhc/config.rb', line 31 def interceptors (@interceptors || []).dup end |
#interceptors=(interceptors) ⇒ Object
35 36 37 38 |
# File 'lib/lhc/config.rb', line 35 def interceptors=(interceptors) raise 'Default interceptors already set and can only be set once' if @interceptors @interceptors = interceptors end |
#placeholder(name, value) ⇒ Object
21 22 23 24 25 |
# File 'lib/lhc/config.rb', line 21 def placeholder(name, value) name = name.to_sym raise 'Placeholder already exists for that name' if @placeholders[name] @placeholders[name] = value end |
#placeholders ⇒ Object
27 28 29 |
# File 'lib/lhc/config.rb', line 27 def placeholders @placeholders.dup end |
#reset ⇒ Object
40 41 42 43 44 |
# File 'lib/lhc/config.rb', line 40 def reset @endpoints = {} @placeholders = {} @interceptors = nil end |