Module: RenderWithView
- Defined in:
- lib/render_with_view.rb,
lib/render_with_view/version.rb,
lib/render_with_view/half_open_struct.rb
Defined Under Namespace
Classes: HalfOpenStruct, View
Constant Summary collapse
- VERSION =
'0.1.2'
Class Method Summary collapse
Class Method Details
.included(kls) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/render_with_view.rb', line 7 def self.included kls kls.class_eval do def render_with_view *args if !args.first.is_a?(Hash) tmpl = args.shift else tmpl = action_name end locals = args.shift opts = args.shift || {} # save to ivar for testing purposes @__view__ = View.new(locals) render tmpl, opts.merge(locals: { view: @__view__ }) end end end |