class Easyrb::Local
Attributes
context[R]
#
Declarations #
#
hash[R]
#
Declarations #
#
Public Class Methods
[](context, hash)
click to toggle source
#
Class Methods #
#
# File lib/easyrb/local.rb, line 30 def self.[](context, hash) new(context, hash).generate_binding end
new(context, hash)
click to toggle source
#
Constructor #
#
# File lib/easyrb/local.rb, line 19 def initialize(context, hash) @context = context @hash = hash || Hash.new end
Public Instance Methods
generate_binding()
click to toggle source
#
Instance Methods #
#
# File lib/easyrb/local.rb, line 40 def generate_binding locals_function.(*values) end
Private Instance Methods
function_string()
click to toggle source
# File lib/easyrb/local.rb, line 46 def function_string locals_string = "#{ keys.join(', ') }, = args;" if keys.any? "->(*args) { #{ locals_string } ->(){}.binding }" end
keys()
click to toggle source
# File lib/easyrb/local.rb, line 52 def keys hash.keys end
locals_function()
click to toggle source
# File lib/easyrb/local.rb, line 56 def locals_function context.instance_eval(function_string) end
values()
click to toggle source
# File lib/easyrb/local.rb, line 60 def values hash.values end