Module: Ark::Configurable
Instance Attribute Summary collapse
-
#ip ⇒ Object
Returns the value of attribute ip.
-
#nethash ⇒ Object
Returns the value of attribute nethash.
-
#port ⇒ Object
Returns the value of attribute port.
-
#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
#ip ⇒ Object
Returns the value of attribute ip.
3 4 5 |
# File 'lib/ark/configurable.rb', line 3 def ip @ip end |
#nethash ⇒ Object
Returns the value of attribute nethash.
3 4 5 |
# File 'lib/ark/configurable.rb', line 3 def nethash @nethash end |
#port ⇒ Object
Returns the value of attribute port.
3 4 5 |
# File 'lib/ark/configurable.rb', line 3 def port @port end |
#version ⇒ Object
Returns the value of attribute version.
3 4 5 |
# File 'lib/ark/configurable.rb', line 3 def version @version end |
Class Method Details
.keys ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/ark/configurable.rb', line 6 def keys @keys ||= [ :ip, :port, :nethash, :version ] end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
Set configuration options using a block
17 18 19 |
# File 'lib/ark/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/ark/configurable.rb', line 22 def reset! Ark::Configurable.keys.each do |key| instance_variable_set(:"@#{key}", Ark::Default.[key]) end self end |
#same_options?(opts) ⇒ Boolean
Compares client options to a Hash of requested options
34 35 36 |
# File 'lib/ark/configurable.rb', line 34 def (opts) opts.hash == .hash end |