Sha256: b1d10bbce25f16ee0e2d9905908e8fe86c2e265ea419a91caabfbc4a94e18a8b
Contents?: true
Size: 642 Bytes
Versions: 5
Compression:
Stored size: 642 Bytes
Contents
module DebugBar module Ext # Binding extensions that are decorated onto bindings passed into callbacks. module Binding # A regex for matching only valid local, instance, class, and global variables, as well as constatns. VARIABLE_PATTERN = /^(@{1,2}|\$)?([_a-zA-Z]\w*)$/ # Returns the value of the given variable symbol within the binding. # Supports local, instance, class, or global variables, as well as constants. def [](var) raise NameError, "#{var.inspect} is not a valid variable name" unless var.to_s =~ VARIABLE_PATTERN return self.eval(var.to_s) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems