Sha256: 7fe286f774a4456493ef3a63f0270c3a25187edb1ac89720584fd2759b7d9a99
Contents?: true
Size: 1.09 KB
Versions: 3
Compression:
Stored size: 1.09 KB
Contents
class ::Binding # @private def initialize(jseval, scope_variables, receiver, source_location) @jseval, @scope_variables, @receiver, @source_location = \ jseval, scope_variables, receiver, source_location end def js_eval(*args) if @jseval @jseval.call(*args) else ::Kernel.raise 'Evaluation on a Proc#binding is not supported' end end def local_variable_get(symbol) js_eval(symbol) rescue ::Exception ::Kernel.raise ::NameError, "local variable `#{symbol}' is not defined for #{inspect}" end def local_variable_set(symbol, value) js_eval(symbol, value) end def local_variables @scope_variables end def local_variable_defined?(value) @scope_variables.include?(value) end def eval(str, file = nil, line = nil) return receiver if str == 'self' ::Kernel.eval(str, self, file, line) end attr_reader :receiver, :source_location end module ::Kernel def binding ::Kernel.raise "Opal doesn't support dynamic calls to binding" end end TOPLEVEL_BINDING = binding `#{TOPLEVEL_BINDING}.source_location = ["<main>", 0]`
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
opal-1.4.1 | opal/corelib/binding.rb |
opal-1.4.0 | opal/corelib/binding.rb |
opal-1.4.0.alpha1 | opal/corelib/binding.rb |