Sha256: 1bf635fc71755c8b945955951331fcdf25f1f256f3ef2795b0f26be11616d171
Contents?: true
Size: 1.12 KB
Versions: 2
Compression:
Stored size: 1.12 KB
Contents
module RainforestRubyRuntime module Variables class Registery def initialize(variables = {}) @variables = {} end def register(variable) variables[variable.name] = variable end def has_variable?(name) variables.has_key?(name) end def [](name) variables[name] end private attr_reader :variables end class StaticVariableRegistery def initialize(variables) @variables = variables.inject({}) do |variables, (name, var_and_values)| scope = Scope.new(name) var_and_values.each do |name, value| scope.define_variable(name.to_sym) { value } end variables[name] = scope variables end end def has_variable?(name) @variables.has_key?(name.to_s) end def [](name) @variables[name.to_s] end def register(*) # noop end end def self.scope_registery @scope_registery ||= Registery.new end def self.scope_registery=(registery) @scope_registery = registery end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rainforest_ruby_runtime-0.0.2 | lib/rainforest_ruby_runtime/variables/registery.rb |
rainforest_ruby_runtime-0.0.1 | lib/rainforest_ruby_runtime/variables/registery.rb |