Module: RenderAnywhere

Defined in:
lib/render_anywhere.rb,
lib/render_anywhere/version.rb,
lib/render_anywhere/rendering_controller.rb

Defined Under Namespace

Classes: RenderingController

Constant Summary collapse

VERSION =
"0.0.12"

Instance Method Summary collapse

Instance Method Details

#render(*args) ⇒ Object



8
9
10
# File 'lib/render_anywhere.rb', line 8

def render(*args)
  rendering_controller.render_to_string(*args)
end

#rendering_controllerObject



27
28
29
# File 'lib/render_anywhere.rb', line 27

def rendering_controller
  @rendering_controller ||= self.class.const_get("RenderingController").new
end

#set_instance_variable(var, value) ⇒ Object



20
21
22
23
24
25
# File 'lib/render_anywhere.rb', line 20

def set_instance_variable(var, value)
  rendering_controller.class_eval do
    attr_accessor :"#{var}"
  end
  rendering_controller.public_send("#{var}=", value)
end

#set_render_anywhere_helpers(*args) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/render_anywhere.rb', line 12

def set_render_anywhere_helpers(*args)
  args.each do |helper_name|
    rendering_controller.class_eval do
      helper helper_name.to_s.constantize
    end
  end
end