Sha256: 5cad37dff3819f01a278a4994df42ef1383429ecd185e4c998fa10e7d6faa2a9

Contents?: true

Size: 401 Bytes

Versions: 15

Compression:

Stored size: 401 Bytes

Contents

module Rbexy
  module ComponentContext
    def rbexy_context
      @rbexy_context ||= [{}]
    end

    def create_context(name, value)
      rbexy_context.last[name] = value
    end

    def use_context(name)
      index = rbexy_context.rindex { |c| c.has_key?(name) }
      index ?
        rbexy_context[index][name] :
        raise(ContextNotFound, "no parent context `#{name}`")
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
rbexy-2.0.0.rc5 lib/rbexy/component_context.rb
rbexy-2.0.0.rc4 lib/rbexy/component_context.rb
rbexy-2.0.0.rc3 lib/rbexy/component_context.rb
rbexy-2.0.0.rc2 lib/rbexy/component_context.rb
rbexy-2.0.0.rc1 lib/rbexy/component_context.rb
rbexy-2.0.0.beta9 lib/rbexy/component_context.rb
rbexy-2.0.0.beta8 lib/rbexy/component_context.rb
rbexy-2.0.0.beta7 lib/rbexy/component_context.rb
rbexy-2.0.0.beta6 lib/rbexy/component_context.rb
rbexy-2.0.0.beta5 lib/rbexy/component_context.rb
rbexy-2.0.0.beta4 lib/rbexy/component_context.rb
rbexy-2.0.0.beta3 lib/rbexy/component_context.rb
rbexy-2.0.0.beta2 lib/rbexy/component_context.rb
rbexy-2.0.0.beta1 lib/rbexy/component_context.rb
rbexy-1.1.0 lib/rbexy/component_context.rb