Class: Tzispa::Rig::Engine
- Inherits:
-
Object
- Object
- Tzispa::Rig::Engine
- Defined in:
- lib/tzispa/rig/engine.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
Instance Method Summary collapse
- #block(name:, format: nil, params: nil, parent: nil) ⇒ Object
-
#initialize(app, cache_enabled, cache_size) ⇒ Engine
constructor
A new instance of Engine.
- #layout(name:, format: nil, params: nil) ⇒ Object
- #rig_template(name, type, tpl_format, params, parent) ⇒ Object
- #static(name:, format: nil, params: nil, parent: nil) ⇒ Object
Constructor Details
#initialize(app, cache_enabled, cache_size) ⇒ Engine
Returns a new instance of Engine.
14 15 16 17 |
# File 'lib/tzispa/rig/engine.rb', line 14 def initialize(app, cache_enabled, cache_size) @app = app @cache = LruRedux::ThreadSafeCache.new(cache_size) if cache_enabled end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
12 13 14 |
# File 'lib/tzispa/rig/engine.rb', line 12 def app @app end |
Instance Method Details
#block(name:, format: nil, params: nil, parent: nil) ⇒ Object
23 24 25 |
# File 'lib/tzispa/rig/engine.rb', line 23 def block(name:, format:nil, params:nil, parent:nil) rig_template name, :block, format, params, parent end |
#layout(name:, format: nil, params: nil) ⇒ Object
19 20 21 |
# File 'lib/tzispa/rig/engine.rb', line 19 def layout(name:, format:nil, params:nil) rig_template name, :layout, format, params, nil end |
#rig_template(name, type, tpl_format, params, parent) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/tzispa/rig/engine.rb', line 31 def rig_template(name, type, tpl_format, params, parent) if @cache cache_template(name, type, tpl_format, params, parent) else Template.new(name: name, type: type, format: tpl_format, domain: @app.domain, params: params, parent: parent, engine: self).load!.parse! end end |
#static(name:, format: nil, params: nil, parent: nil) ⇒ Object
27 28 29 |
# File 'lib/tzispa/rig/engine.rb', line 27 def static(name:, format:nil, params:nil, parent:nil) rig_template name, :static, format, params, parent end |