Module: Padrino::Rendering

Defined in:
padrino-helpers/lib/padrino/rendering.rb,
padrino-helpers/lib/padrino/rendering/erb_template.rb,
padrino-helpers/lib/padrino/rendering/haml_template.rb,
padrino-helpers/lib/padrino/rendering/slim_template.rb,
padrino-helpers/lib/padrino/rendering/erubis_template.rb

Overview

Padrino enhances the Sinatra 'render' method to have support for automatic template engine detection, enhanced layout functionality, locale enabled rendering, among other features.

Defined Under Namespace

Modules: ClassMethods, InstanceMethods, SafeBufferEnhancer, SafeTemplate Classes: ERBTemplate, ErubisTemplate, HamlTemplate, SafeERB, SafeEruby, SlimTemplate, TemplateNotFound

Constant Summary

IGNORE_FILE_PATTERN =
[
  /~$/ # This is for Gedit
]
CONTENT_TYPE_ALIASES =

Defines common content-type alias mappings.

{ :htm => :html }
DEFAULT_RENDERING_OPTIONS =
{ :strict_format => false, :raise_exceptions => true }

Class Method Summary collapse

Class Method Details

.engine_configurationsHash<Symbol,Hash>

Default engine configurations for Padrino::Rendering.

Returns:

  • (Hash<Symbol,Hash>)

    The configurations, keyed by engine.



53
54
55
# File 'padrino-helpers/lib/padrino/rendering.rb', line 53

def engine_configurations
  @engine_configurations ||= {}
end

.registered(app) ⇒ Object



57
58
59
60
61
62
63
64
65
66
# File 'padrino-helpers/lib/padrino/rendering.rb', line 57

def registered(app)
  if defined?(Padrino::Application) && app == Padrino::Application
    # this fail can be removed later when jRuby is not bugged and MRI19 is dropped
    fail 'Please, do not use `register` on Padrino::Application object, use `.dup` or subclassing'
  end
  included(app)
  engine_configurations.each do |engine, configs|
    app.set engine, configs
  end
end