Module: Mnam::Configurable
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#nethash ⇒ Object
Returns the value of attribute nethash.
-
#network_address ⇒ Object
Returns the value of attribute network_address.
-
#version ⇒ Object
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
-
#configure {|_self| ... } ⇒ Object
Set configuration options using a block.
-
#reset! ⇒ Object
(also: #setup)
Reset configuration options to default values.
-
#same_options?(opts) ⇒ Boolean
Compares client options to a Hash of requested options.
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
3 4 5 |
# File 'lib/mnam/configurable.rb', line 3 def host @host end |
#nethash ⇒ Object
Returns the value of attribute nethash.
3 4 5 |
# File 'lib/mnam/configurable.rb', line 3 def nethash @nethash end |
#network_address ⇒ Object
Returns the value of attribute network_address.
3 4 5 |
# File 'lib/mnam/configurable.rb', line 3 def network_address @network_address end |
#version ⇒ Object
Returns the value of attribute version.
3 4 5 |
# File 'lib/mnam/configurable.rb', line 3 def version @version end |
Class Method Details
.keys ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/mnam/configurable.rb', line 6 def keys @keys ||= [ :host, :nethash, :version, :network_address ] end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
Set configuration options using a block
17 18 19 |
# File 'lib/mnam/configurable.rb', line 17 def configure yield self end |
#reset! ⇒ Object Also known as: setup
Reset configuration options to default values
22 23 24 25 26 27 |
# File 'lib/mnam/configurable.rb', line 22 def reset! Mnam::Configurable.keys.each do |key| instance_variable_set(:"@#{key}", Mnam::Default.[key]) end self end |
#same_options?(opts) ⇒ Boolean
Compares client options to a Hash of requested options
34 35 36 |
# File 'lib/mnam/configurable.rb', line 34 def (opts) opts.hash == .hash end |