Class: GenericJob::Stub

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

Instance Method Summary collapse

Constructor Details

#initialize(receiver, opts) ⇒ Stub

Returns a new instance of Stub.



5
6
7
8
9
# File 'lib/generic_job/stub.rb', line 5

def initialize(receiver, opts)
  @receiver = receiver
  @opts = opts
  @init_args = nil
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



15
16
17
18
19
20
21
# File 'lib/generic_job/stub.rb', line 15

def method_missing(name, *args, &_block)
  if receiver_has_method? name
    call_missing_method name.to_s, *args
  else
    super
  end
end

Instance Method Details

#new(*args) ⇒ Object



23
24
25
26
# File 'lib/generic_job/stub.rb', line 23

def new(*args)
  @init_args = args.first
  self
end

#respond_to_missing?(name, include_private) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/generic_job/stub.rb', line 11

def respond_to_missing?(name, include_private)
  receiver_has_method?(name) || super
end