Class: Waw::StaticController
- Inherits:
-
Controller
- Object
- Controller
- Waw::StaticController
- Defined in:
- lib/waw/controllers/static_controller.rb,
lib/waw/controllers/static/match.rb,
lib/waw/controllers/static/matcher.rb,
lib/waw/controllers/static/waw_access.rb,
lib/waw/controllers/static/waw_access_dsl.rb
Overview
A waw service that serves public pages expressed in wlang wtpl format
Defined Under Namespace
Classes: AbstractMatcher, AndMatcher, Matcher, NegateMatcher, OrMatcher, WawAccess
Constant Summary collapse
- DEFAULT_OPTIONS =
Default options of this service
{:public => 'public'}
Constants included from EnvironmentUtils
EnvironmentUtils::DEPRECATED_MSG
Instance Method Summary collapse
-
#call(env) ⇒ Object
Executes the service.
-
#initialize(opts = {}) ⇒ StaticController
constructor
Creates a service instance.
-
#public_folder ⇒ Object
Returns the template folder.
Methods inherited from Controller
Methods included from Rack::Delegator
#_visit, #delegate, #find_rack_app, #find_url_of, #has_delegate?, #is_delegate?, #visit
Methods included from EnvironmentUtils
#env, #session_get, #session_has_key?, #session_set, #session_unset
Methods included from ScopeUtils
#config, #find_kernel_context, #logger, #params, #rack_env, #real_session, #request, #resources, #response, #root_folder, #session
Constructor Details
#initialize(opts = {}) ⇒ StaticController
Creates a service instance
20 21 22 23 |
# File 'lib/waw/controllers/static_controller.rb', line 20 def initialize(opts = {}) @options = DEFAULT_OPTIONS.merge(opts) @wawaccess = ::Waw::StaticController::WawAccess.load_hierarchy(File.join(root_folder, public_folder)) end |
Instance Method Details
#call(env) ⇒ Object
Executes the service
35 36 37 |
# File 'lib/waw/controllers/static_controller.rb', line 35 def call(env) @wawaccess.call(env) end |
#public_folder ⇒ Object
Returns the template folder
26 27 28 |
# File 'lib/waw/controllers/static_controller.rb', line 26 def public_folder @options[:public] || @options[:root] end |