Class: Hapyrus::Proxy

Inherits:
Object
  • Object
show all
Defined in:
lib/hapyrus/proxy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



12
13
14
# File 'lib/hapyrus/proxy.rb', line 12

def method_missing(method, *args)
  run_command(method, args)
end

Instance Attribute Details

#command_classObject

Returns the value of attribute command_class.



3
4
5
# File 'lib/hapyrus/proxy.rb', line 3

def command_class
  @command_class
end

Instance Method Details

#run_command(method, *args) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/hapyrus/proxy.rb', line 4

def run_command(method, *args)
  args.flatten!
  if args.size > 0
    @command_class.new.send(method, *args)
  else
    @command_class.new.send(method)
  end
end