class Object
def pe(*args, bndng)
args.each do |arg| puts arg, eval(arg, binding).inspect end
end
Public Class Methods
find_all_methods_like(method)
click to toggle source
# File lib/rubyhacks.rb, line 25 def self.find_all_methods_like(method) method = method === Regexp ? method : Regexp.new(method) return constants.inject({}) do |hash,ob| ob = const_get(ob) begin hash[ob] = (ob.methods + ob.instance_methods).find_all{|meth| meth =~ method} hash.delete(ob) if hash[ob].size == 0 rescue end hash end end
Public Instance Methods
instance_variable_set(var,*args)
click to toggle source
# File lib/rubyhacks.rb, line 186 def instance_variable_set(var,*args) var = var.to_s=~ /^@/ ? var : "@" + var.to_s old_instance_variable_set(var, *args) end
phoenix(file_name)
click to toggle source
# File lib/rubyhacks.rb, line 899 def phoenix(file_name) File.open(file_name, 'w'){|file| file.puts "# coding: utf-8"; file.puts self.pretty_inspect} end
set(v, *args)
click to toggle source
# File lib/rubyhacks.rb, line 21 def set(v, *args) send(v+"=".to_sym, *args) end