Class: PageContext
- Inherits:
-
Radius::Context
- Object
- Radius::Context
- PageContext
- Defined in:
- app/models/page_context.rb
Instance Attribute Summary collapse
-
#page ⇒ Object
readonly
Returns the value of attribute page.
Instance Method Summary collapse
-
#initialize(page) ⇒ PageContext
constructor
A new instance of PageContext.
- #render_tag(name, attributes = {}, &block) ⇒ Object
- #tag_missing(name, attributes = {}, &block) ⇒ Object
Constructor Details
#initialize(page) ⇒ PageContext
Returns a new instance of PageContext.
7 8 9 10 11 12 13 14 |
# File 'app/models/page_context.rb', line 7 def initialize(page) super() @page = page globals.page = @page page..each do |name| define_tag(name) { |tag_binding| page.render_tag(name, tag_binding) } end end |
Instance Attribute Details
#page ⇒ Object (readonly)
Returns the value of attribute page.
5 6 7 |
# File 'app/models/page_context.rb', line 5 def page @page end |
Instance Method Details
#render_tag(name, attributes = {}, &block) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'app/models/page_context.rb', line 16 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
27 28 29 30 31 |
# File 'app/models/page_context.rb', line 27 def tag_missing(name, attributes = {}, &block) super rescue Radius::UndefinedTagError => e raise StandardTags::TagError.new(e.) end |