Class: SknUtils::ActionService

Inherits:
Object
  • Object
show all
Defined in:
lib/skn_utils/action_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(dependency_injection_arguments) ⇒ ActionService

Returns a new instance of ActionService.



12
13
14
# File 'lib/skn_utils/action_service.rb', line 12

def initialize(dependency_injection_arguments)
  @thingy = dependency_injection_arguments
end

Instance Method Details

#call(*command_and_params) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/skn_utils/action_service.rb', line 16

def call(*command_and_params)
  puts "Called with: #{command_and_params}"
  value = command_and_params
  if value.first.is_a?(Symbol)
    (value.size == 1 ? self.send(value.first) : self.send(value.first, value[1..-1]))
  else
    puts('No Action Taken')
  end

  self
end