Class: AbstractHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/hypertube-ruby-sdk/core/handler/abstract_handler.rb

Instance Method Summary collapse

Instance Method Details

#handle_command(command) ⇒ Object



12
13
14
15
# File 'lib/hypertube-ruby-sdk/core/handler/abstract_handler.rb', line 12

def handle_command(command)
  iterate(command) unless command.command_type == CommandType::OPTIMIZE
  process(command)
end

#process(_command) ⇒ Object



8
9
10
# File 'lib/hypertube-ruby-sdk/core/handler/abstract_handler.rb', line 8

def process(_command)
  raise 'process is not implemented'
end

#validate(command, required_parameters_count, caller_type_name) ⇒ Object

Raises:

  • (ArgumentError)


17
18
19
# File 'lib/hypertube-ruby-sdk/core/handler/abstract_handler.rb', line 17

def validate(command, required_parameters_count, caller_type_name)
  raise ArgumentError, "#{caller_type_name} parameters mismatch" if command.payload.length < required_parameters_count
end