Module: Padrino::Rendering::InstanceMethods

Defined in:
padrino-helpers/lib/padrino/rendering.rb

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#current_engineObject (readonly)

Returns the value of attribute current_engine



145
146
147
# File 'padrino-helpers/lib/padrino/rendering.rb', line 145

def current_engine
  @current_engine
end

Instance Method Details

#content_type(type = nil, params = {}) ⇒ Object

Get/Set the content_type

Examples:

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'

Parameters:

  • type (String, nil) (defaults to: nil)

    The Content-Type to use.

  • type. (Symbol, nil)

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

  • params (Hash) (defaults to: {})

    Additional params to append to the Content-Type.



171
172
173
174
175
176
177
# File 'padrino-helpers/lib/padrino/rendering.rb', line 171

def content_type(type=nil, params={})
  if type
    super(type, params)
    @_content_type = type
  end
  @_content_type
end