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/erubi_template.rb,
lib/padrino/rendering/erubis_template.rb,
lib/padrino/rendering/hamlit_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, Erubi, InstanceMethods, SafeBufferEnhancer, SafeTemplate Classes: ERBTemplate, ErubiTemplate, ErubisTemplate, HamlTemplate, HamlitOutputBuffer, HamlitTemplate, SafeERB, SafeErubi, SafeEruby, SlimOutputBuffer, 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.



54
55
56
# File 'lib/padrino/rendering.rb', line 54

def engine_configurations
  @engine_configurations ||= {}
end

.included(base) ⇒ Object



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

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

.registered(app) ⇒ Object



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

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