Module: Padrino::Rendering

Defined in:
lib/padrino/rendering.rb,
lib/padrino/rendering/erb_template.rb,
lib/padrino/rendering/haml_template.rb,
lib/padrino/rendering/slim_template.rb,
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 collapse

IGNORE_FILE_PATTERN =

This is an array of file patterns to ignore. If your editor add a suffix during editing to your files please add it like:

Examples:

Padrino::Rendering::IGNORE_FILE_PATTERN << /~$/
[
  /~$/ # This is for Gedit
]
CONTENT_TYPE_ALIASES =

Defines common content-type alias mappings.

{ :htm => :html }
DEFAULT_RENDERING_OPTIONS =

Default options used in the resolve_template-method.

{ :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 'lib/padrino/rendering.rb', line 53

def engine_configurations
  @engine_configurations ||= {}
end

.included(base) ⇒ Object



68
69
70
71
# File 'lib/padrino/rendering.rb', line 68

def included(base)
  base.send(:include, InstanceMethods)
  base.extend(ClassMethods)
end

.registered(app) ⇒ Object



57
58
59
60
61
62
63
64
65
66
# File '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