Module: RepresentativeView::ViewHelpers

Included in:
ActionView::Base
Defined in:
lib/representative_view/view_helpers.rb

Instance Method Summary collapse

Instance Method Details

#representative(format, &block) ⇒ Object



19
20
21
22
23
# File 'lib/representative_view/view_helpers.rb', line 19

def representative(format, &block)
  r = create_representative(format)
  with_representative(r, &block)
  r.to_s
end

#representative_view(format) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/representative_view/view_helpers.rb', line 9

def representative_view(format)
  if current_representative
    yield current_representative
  else
    representative(format) do
      yield current_representative
    end
  end
end