class RainforestRubyRuntime::Variables::Scope

Attributes

block[R]
name[R]

Public Class Methods

new(*, &block) click to toggle source
Calls superclass method
# File lib/rainforest_ruby_runtime/variables/scope.rb, line 6
def initialize(*, &block)
  super
  @registry = Registry.new
  instance_eval &block if block_given?
end

Public Instance Methods

define_variable(name, &block) click to toggle source
# File lib/rainforest_ruby_runtime/variables/scope.rb, line 12
def define_variable(name, &block)
  @registry.register Value.new(name, &block)
end
method_missing(name, *args, &block) click to toggle source
Calls superclass method
# File lib/rainforest_ruby_runtime/variables/scope.rb, line 16
def method_missing(name, *args, &block)
  if @registry.has_variable?(name)
    @registry[name].call *args, &block
  else
    super
  end
end