Class: Neb::Configuration
- Inherits:
-
Object
- Object
- Neb::Configuration
- Extended by:
- Forwardable
- Defined in:
- lib/neb/configuration.rb
Constant Summary collapse
- DEFAULTS =
{ host: "http://127.0.0.1:8685", timeout: 600, api_version: "/v1", log: STDOUT, log_level: :info, api_endpoint: "/user", admin_endpoint: "/admin" }.freeze
Instance Method Summary collapse
- #clear ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #merge(hash) ⇒ Object
- #merge!(hash) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
19 20 21 |
# File 'lib/neb/configuration.rb', line 19 def initialize clear end |
Instance Method Details
#clear ⇒ Object
23 24 25 |
# File 'lib/neb/configuration.rb', line 23 def clear @hash = DEFAULTS.dup end |
#merge(hash) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/neb/configuration.rb', line 32 def merge(hash) instance = self.class.new instance.merge!(to_hash) instance.merge!(hash) instance end |
#merge!(hash) ⇒ Object
27 28 29 30 |
# File 'lib/neb/configuration.rb', line 27 def merge!(hash) hash = hash.dup @hash = @hash.deep_merge(hash) end |