Sha256: 1ae19705205c8ff2d6d359cb4e2d7744e21f460e6393362aff25ae856da3c07d
Contents?: true
Size: 748 Bytes
Versions: 4
Compression:
Stored size: 748 Bytes
Contents
class PageContext < Radius::Context attr_reader :page def initialize(page) super() @page = page globals.page = @page page.tags.each do |name| define_tag(name) { |tag_binding| page.render_tag(name, tag_binding) } end end def render_tag(name, attributes = {}, &block) super rescue Exception => e raise e if testing? render_error_message(e.message) end def tag_missing(name, attributes = {}, &block) super rescue Radius::UndefinedTagError => e raise StandardTags::TagError.new(e.message) end private def render_error_message(message) "<div><strong>#{message}</strong></div>" end def testing? RAILS_ENV == 'test' end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
radiant-0.6.0 | app/models/page_context.rb |
radiant-0.6.1 | app/models/page_context.rb |
radiant-0.6.2 | app/models/page_context.rb |
radiant-0.6.3 | app/models/page_context.rb |