module DebugBar::Ext::Binding
Binding
extensions that are decorated onto bindings passed into callbacks.
Constants
- VARIABLE_PATTERN
A regex for matching only valid local, instance, class, and global variables, as well as constatns.
Public Instance Methods
[](var)
click to toggle source
Returns the value of the given variable symbol within the binding. Supports local, instance, class, or global variables, as well as constants.
# File lib/debug-bar/ext/binding.rb, line 10 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