Sha256: 5a31626e23b568a22694425f9206ee7e775b8b6a918a3c05808c4087feebee9e

Contents?: true

Size: 687 Bytes

Versions: 1

Compression:

Stored size: 687 Bytes

Contents

class TextAssetContext < Radius::Context

  def initialize(text_asset)
    super()
    globals.text_asset = text_asset
    text_asset.tags.each do |name|
      define_tag(name) { |tag_binding| text_asset.render_tag(name, tag_binding) }
    end
  end


  def render_tag(name, attributes = {}, &block)
    super
  rescue Exception => e
    raise e if raise_errors?
    @tag_binding_stack.pop unless @tag_binding_stack.last == binding
    e.message
  end


  def tag_missing(name, attributes = {}, &block)
    super
  rescue Radius::UndefinedTagError => e
    raise StandardTags::TagError.new(e.message)
  end


  private

    def raise_errors?
      RAILS_ENV != 'production'
    end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
radiant-sns-extension-0.9.0 app/models/text_asset_context.rb