Module: Gunter::Views

Defined in:
lib/gunter/views.rb

Overview

Gunter views module

Class Method Summary collapse

Class Method Details

.render(format, template, data) ⇒ String

Render templates

Examples:

Gunter.render(:json, :templates, data)

Parameters:

  • format (Symbol)

    the format to render

  • template (Symbol)

    the template to render

  • data (Hash)

    the data to render

Returns:

  • (String)

    the rendered template



18
19
20
21
22
23
24
25
# File 'lib/gunter/views.rb', line 18

def render(format, template, data)
  case format
  when :json
    Gunter::View::Json.send(template, data)
  else
    Gunter::View::Text.send(template, data)
  end
end