Class: Envoi::Mam::Agent::BaseDaemon

Inherits:
Object
  • Object
show all
Defined in:
lib/envoi/mam/agent/base_daemon.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ BaseDaemon

Returns a new instance of BaseDaemon.



9
10
11
# File 'lib/envoi/mam/agent/base_daemon.rb', line 9

def initialize(*args)
  @initial_args = args
end

Instance Attribute Details

#initial_argsObject

Returns the value of attribute initial_args.



7
8
9
# File 'lib/envoi/mam/agent/base_daemon.rb', line 7

def initial_args
  @initial_args
end

#loggerObject

Returns the value of attribute logger.



7
8
9
# File 'lib/envoi/mam/agent/base_daemon.rb', line 7

def logger
  @logger
end

Instance Method Details

#set_instance_variables(args = nil) ⇒ Object

Processes a hash and creates instance variables for each key set to it’s corresponding value If args is an array then it processes the first hash it comes to in that array (Good for passing *args from a previous method)

Parameters:

  • args (Hash|Array|nil) (defaults to: nil)

    The hash or array to process



17
18
19
20
21
# File 'lib/envoi/mam/agent/base_daemon.rb', line 17

def set_instance_variables(args = nil)
  _args = args
  _args = _args.find { |v| v.is_a? Hash } if _args.is_a? Array
  _args.each { |key, val| instance_variable_set("@#{key}", val) } if _args.is_a? Hash
end