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: "log/neb.log", 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.
18 19 20 |
# File 'lib/neb/configuration.rb', line 18 def initialize clear end |
Instance Method Details
#clear ⇒ Object
22 23 24 |
# File 'lib/neb/configuration.rb', line 22 def clear @hash = DEFAULTS.dup end |
#merge(hash) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/neb/configuration.rb', line 31 def merge(hash) instance = self.class.new instance.merge!(to_hash) instance.merge!(hash) instance end |
#merge!(hash) ⇒ Object
26 27 28 29 |
# File 'lib/neb/configuration.rb', line 26 def merge!(hash) hash = hash.dup @hash = @hash.deep_merge(hash) end |