module Padrino::Rendering::InstanceMethods

Instance methods that allow enhanced rendering to function properly in Padrino.

Attributes

current_engine[R]

Public Instance Methods

content_type(type=nil, params={}) click to toggle source

Get/Set the #content_type

@param [String, nil] type

The Content-Type to use.

@param [Symbol, nil] type.

Look and parse the given symbol to the matched Content-Type.

@param [Hash] params

Additional params to append to the Content-Type.

@example

case content_type
  when :js then do_some
  when :css then do_another
end

content_type :js
# => set the response with 'application/javascript' Content-Type
content_type 'text/html'

# => set directly the Content-Type to 'text/html'
# File lib/padrino/rendering.rb, line 172
def content_type(type=nil, params={})
  if type
    super(type, params)
    @_content_type = type
  end
  @_content_type
end