Class: NetworkExecutive::Configuration
- Inherits:
-
Object
- Object
- NetworkExecutive::Configuration
- Defined in:
- lib/network_executive/configuration.rb
Constant Summary collapse
- @@defaults =
HashWithIndifferentAccess.new( name: 'My Network' )
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #attributes ⇒ Object (also: #to_hash)
- #defaults ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
11 12 13 |
# File 'lib/network_executive/configuration.rb', line 11 def initialize @@defaults.dup.each_pair { |k, v| self.send "#{k}=", v } end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/network_executive/configuration.rb', line 5 def name @name end |
Instance Method Details
#attributes ⇒ Object Also known as: to_hash
19 20 21 22 23 |
# File 'lib/network_executive/configuration.rb', line 19 def attributes self.class.defaults.keys.each_with_object(HashWithIndifferentAccess.new) do |k, hash| hash[k] = self.send k end end |
#defaults ⇒ Object
15 16 17 |
# File 'lib/network_executive/configuration.rb', line 15 def defaults @@defaults end |