Class: Munna::Proxy::Base

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

Direct Known Subclasses

Delete, Write

Instance Method Summary collapse

Constructor Details

#initialize(kclass, target, options = {}, &block) ⇒ Base

Returns a new instance of Base.



4
5
6
7
8
# File 'lib/munna/proxy/base.rb', line 4

def initialize(kclass, target, options={}, &block)
  @kclass = kclass
  @target = target
  @opts = options
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



10
11
12
# File 'lib/munna/proxy/base.rb', line 10

def method_missing(name, *args, &block)
  __perform__ Execute.new @target, {:name => name, :args => args, :block => block}
end

Instance Method Details

#__perform__(execute) ⇒ Object



14
15
16
# File 'lib/munna/proxy/base.rb', line 14

def __perform__(execute)
  @kclass.new(@target, @opts, execute).send("perform_#{self.class.name.demodulize.downcase}")
end