Module: SimpleService::ClassMethods

Defined in:
lib/simple_service.rb

Instance Method Summary collapse

Instance Method Details

#call(**kwargs) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/simple_service.rb', line 22

def call(**kwargs)
  service = self.new

  if service.method(:call).arity.zero?
    service.call
  else
    service.call(kwargs)
  end
end

#command(command_name) ⇒ Object



32
33
34
35
# File 'lib/simple_service.rb', line 32

def command(command_name)
  @commands ||= []
  @commands << command_name
end

#commands(*args) ⇒ Object



37
38
39
40
# File 'lib/simple_service.rb', line 37

def commands(*args)
  @commands ||= []
  @commands += args
end