Class: WIP::Runner::Renderer::Helper

Inherits:
Object
  • Object
show all
Defined in:
lib/wip/runner/renderer/helper.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, mod) ⇒ Helper

Returns a new instance of Helper.



7
8
9
10
# File 'lib/wip/runner/renderer/helper.rb', line 7

def initialize(context, mod)
  self.instance_eval { extend mod }
  @context = context
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object (protected)



14
15
16
17
18
19
20
# File 'lib/wip/runner/renderer/helper.rb', line 14

def method_missing(method_name, *args, &block)
  if @context.respond_to?(method_name)
    @context.send(method_name, *args, &block)
  else
    super
  end
end

Class Method Details

.for(context, mod) ⇒ Object



3
4
5
# File 'lib/wip/runner/renderer/helper.rb', line 3

def self.for(context, mod)
  self.new(context, mod)
end