Module: ActionController::Renderers::ClassMethods

Defined in:
lib/action_controller/metal/renderers.rb

Instance Method Summary collapse

Instance Method Details

#_write_render_optionsObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/action_controller/metal/renderers.rb', line 18

def _write_render_options
  renderers = _renderers.map do |name, value|
    <<-RUBY_EVAL
      if options.key?(:#{name})
        _process_options(options)
        return _render_option_#{name}(options.delete(:#{name}), options)
      end
    RUBY_EVAL
  end

  class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
    def _handle_render_options(options)
      #{renderers.join}
    end
  RUBY_EVAL
end

#use_renderers(*args) ⇒ Object Also known as: use_renderer



35
36
37
38
39
40
41
42
# File 'lib/action_controller/metal/renderers.rb', line 35

def use_renderers(*args)
  new = _renderers.dup
  args.each do |key|
    new[key] = RENDERERS[key]
  end
  self._renderers = new.freeze
  _write_render_options
end