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 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.



56
57
58
# File 'lib/padrino/rendering.rb', line 56

def engine_configurations
  @engine_configurations ||= {}
end

.included(base) ⇒ Object



71
72
73
74
# File 'lib/padrino/rendering.rb', line 71

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

.registered(app) ⇒ Object



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

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
    raise '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