Method: Perus::Pinger::Command#initialize

Defined in:
lib/perus/pinger/command.rb

#initialize(option_values, id = nil) ⇒ Command

create a command instance and initialise it with the provided option values (hash where keys are option names). any restricted options are validated first, and an exception is thrown if the provided value is not one of the allowed values for the option.



96
97
98
99
100
101
102
103
104
105
# File 'lib/perus/pinger/command.rb', line 96

def initialize(option_values, id = nil)
    @options = OpenStruct.new
    self.class.options.each do |option|
        option.process(@options, option_values)
    end

    # commands (not metrics) have ids that uniquely identify a command
    # instance and its response
    @id = id
end