Class: Subledger::Interface::Dispatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/subledger/interface/dispatcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Dispatcher

Returns a new instance of Dispatcher.



4
5
6
7
8
# File 'lib/subledger/interface/dispatcher.rb', line 4

def initialize args
  @klass  = args[:klass]

  @dispatch_args = args
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, args, &block) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/subledger/interface/dispatcher.rb', line 10

def method_missing method, args, &block
  args.delete :store
  args.delete :client

  merged_args = @dispatch_args.merge args

  @klass.send method, merged_args, &block
end