Class: Fabulator::Template::Context
- Inherits:
-
Radius::Context
- Object
- Radius::Context
- Fabulator::Template::Context
- Defined in:
- lib/fabulator/template/context.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
Instance Method Summary collapse
-
#initialize(parser) ⇒ Context
constructor
A new instance of Context.
- #raise_errors? ⇒ Boolean
- #render_tag(name, attributes = {}, &block) ⇒ Object
- #tag_missing(name, attributes = {}, &block) ⇒ Object
Constructor Details
#initialize(parser) ⇒ Context
Returns a new instance of Context.
8 9 10 11 12 13 14 15 |
# File 'lib/fabulator/template/context.rb', line 8 def initialize(parser) super() @parser = parser globals.context = @context parser..each do |name| define_tag(name) { |tag_binding| parser.render_tag(name, tag_binding) } end end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
6 7 8 |
# File 'lib/fabulator/template/context.rb', line 6 def context @context end |
Instance Method Details
#raise_errors? ⇒ Boolean
17 18 19 |
# File 'lib/fabulator/template/context.rb', line 17 def raise_errors? true end |
#render_tag(name, attributes = {}, &block) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/fabulator/template/context.rb', line 21 def render_tag(name, attributes = {}, &block) binding = @tag_binding_stack.last locals = binding ? binding.locals : globals set_process_variables(locals.page) super rescue Exception => e raise e if raise_errors? @tag_binding_stack.pop unless @tag_binding_stack.last == binding (e.) end |
#tag_missing(name, attributes = {}, &block) ⇒ Object
32 33 34 35 36 |
# File 'lib/fabulator/template/context.rb', line 32 def tag_missing(name, attributes = {}, &block) super rescue Radius::UndefinedTagError => e raise StandardTags::TagError.new(e.) end |