Class: RinterceptorInvocation

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, method, *args) ⇒ RinterceptorInvocation

Returns a new instance of RinterceptorInvocation.



3
4
5
6
7
8
# File 'lib/rinterceptor_invocation.rb', line 3

def initialize(object, method, *args)
  @object = object
  @method = method
  @args = args
  @options = {}
end

Instance Attribute Details

#argsObject

Returns the value of attribute args.



2
3
4
# File 'lib/rinterceptor_invocation.rb', line 2

def args
  @args
end

#methodObject

Returns the value of attribute method.



2
3
4
# File 'lib/rinterceptor_invocation.rb', line 2

def method
  @method
end

#objectObject

Returns the value of attribute object.



2
3
4
# File 'lib/rinterceptor_invocation.rb', line 2

def object
  @object
end

#optionsObject

Returns the value of attribute options.



2
3
4
# File 'lib/rinterceptor_invocation.rb', line 2

def options
  @options
end

Instance Method Details

#invoke(*args) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/rinterceptor_invocation.rb', line 9

def invoke(*args)
  unless @options.nil? || @options.empty?
    @args = @args + [@options]
    @options = nil
  end
  @object.send("old4rinter_#{@method}".to_sym, *(args.empty? ? @args : args))
end