Sha256: 9ec45326b0c12caf12f14c4328b22a68bb9c53af8d6e917fa461c0a6d49dc720

Contents?: true

Size: 893 Bytes

Versions: 6

Compression:

Stored size: 893 Bytes

Contents

require "active_support/all"
require "action_view/helpers"
require "action_view/context"
require "action_view/buffers"

module Rbexy
  class Runtime
    include ActionView::Context
    include ActionView::Helpers::TagHelper
    include ViewContextHelper

    DefaultTagBuilder = ActionView::Helpers::TagHelper::TagBuilder

    def self.create_tag_builder(context, provider = Rbexy.configuration.component_provider)
      if provider
        ComponentTagBuilder.new(context, provider)
      else
        ActionView::Helpers::TagHelper::TagBuilder.new(context)
      end
    end

    def initialize(component_provider = nil)
      @rbexy_tag = self.class.create_tag_builder(self, component_provider)
    end

    def evaluate(code)
      instance_eval(code)
    rescue => e
      e.set_backtrace(e.backtrace.map { |l| l.gsub("(eval)", "(rbx template string)") })
      raise e
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rbexy-0.1.5 lib/rbexy/runtime.rb
rbexy-0.1.4 lib/rbexy/runtime.rb
rbexy-0.1.3 lib/rbexy/runtime.rb
rbexy-0.1.2 lib/rbexy/runtime.rb
rbexy-0.1.1 lib/rbexy/runtime.rb
rbexy-0.1.0 lib/rbexy/runtime.rb