Class: PrestoView::ClassAPI

Inherits:
Object
  • Object
show all
Includes:
API, Config
Defined in:
lib/presto/view/class-api/api.rb

Constant Summary

Constant Summary

Constants included from PrestoCore::Utils

PrestoCore::Utils::PATH_MODIFIERS, PrestoCore::Utils::STATUS__NOT_FOUND, PrestoCore::Utils::STATUS__OK, PrestoCore::Utils::STATUS__PERMANENT_REDIRECT, PrestoCore::Utils::STATUS__REDIRECT, PrestoCore::Utils::STATUS__RESTRICTED, PrestoCore::Utils::STATUS__SERVER_ERROR

Instance Method Summary (collapse)

Methods included from Config

#compile, #compiler_pool, #engine, #engine_args, #engine_opts, #ext, #layout, #layouts_path, #master_layout, #path, #root, #scope

Methods included from Utils

#engine_supported?, #guess_extension, #guess_layout, #guess_path, #guess_scope_and_context

Methods included from PrestoCore::Utils

build_path, #extract_controllers, is_controller?, normalize_path, rootify_url

Methods included from API

#render, #render_layout, #render_master_layout, #render_partial, #render_view

Constructor Details

- (ClassAPI) initialize(controller_or_root = nil)

initializing the View API. if controller given, initialized instance will serve as View API for given controller. otherwise, it will be used as a generic rendering API.

Examples:

render a haml template, not associated to any controller

api = ::PrestoView.new '/abs/path/to/templates/'
api.engine = :Haml
api.render_view 'template.haml'

render a file directly

::PrestoView.render_haml_view '/path/to/template.haml'


19
20
21
22
23
24
# File 'lib/presto/view/class-api/api.rb', line 19

def initialize controller_or_root = nil
  super
  controller_or_root.is_a?(String) ?
      @root = controller_or_root :
      @controller = controller_or_root
end

Instance Method Details

- (Boolean) configurable?

Returns:

  • (Boolean)


26
27
28
# File 'lib/presto/view/class-api/api.rb', line 26

def configurable?
  @controller ? @controller.ctrl.configurable? : true
end