Class: ErrbitZmqHandler::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/errbit_zmq_handler/configuration.rb

Overview

Used to set up and modify settings for the notifier.

Constant Summary collapse

OPTIONS =
[:uri].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#uriObject

The uri to bind to (0MQ socket)



9
10
11
# File 'lib/errbit_zmq_handler/configuration.rb', line 9

def uri
  @uri
end

Instance Method Details

#[](option) ⇒ Object

Allows config options to be read like a hash

Parameters:

  • option (Symbol)

    Key for a given attribute



14
15
16
# File 'lib/errbit_zmq_handler/configuration.rb', line 14

def [](option)
  send(option)
end

#merge(hash) ⇒ Object

Returns a hash of all configurable options merged with hash

Parameters:

  • hash (Hash)

    A set of configuration options that will take precedence over the defaults



28
29
30
# File 'lib/errbit_zmq_handler/configuration.rb', line 28

def merge(hash)
  to_hash.merge(hash)
end

#to_hashObject

Returns a hash of all configurable options



19
20
21
22
23
# File 'lib/errbit_zmq_handler/configuration.rb', line 19

def to_hash
  OPTIONS.inject({}) do |hash, option|
    hash.merge(option.to_sym => send(option))
  end
end