module Ark::Configurable

Attributes

ip[RW]
nethash[RW]
port[RW]
version[RW]

Public Class Methods

keys() click to toggle source
# File lib/ark/configurable.rb, line 6
def keys
  @keys ||= [
    :ip,
    :port,
    :nethash,
    :version
  ]
end

Public Instance Methods

configure() { |self| ... } click to toggle source

Set configuration options using a block

# File lib/ark/configurable.rb, line 17
def configure
  yield self
end
reset!() click to toggle source

Reset configuration options to default values

# File lib/ark/configurable.rb, line 22
def reset!
  Ark::Configurable.keys.each do |key|
    instance_variable_set(:"@#{key}", Ark::Default.options[key])
  end
  self
end
Also aliased as: setup
same_options?(opts) click to toggle source

Compares client options to a Hash of requested options

@param opts [Hash] Options to compare with current client options @return [Boolean]

# File lib/ark/configurable.rb, line 34
def same_options?(opts)
  opts.hash == options.hash
end
setup()
Alias for: reset!

Private Instance Methods

options() click to toggle source
# File lib/ark/configurable.rb, line 40
def options
  Hash[Ark::Configurable.keys.map{|key| [key, instance_variable_get(:"@#{key}")]}]
end