Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/rubyhacks.rb,
lib/rubyhacks.rb,
lib/rubyhacks.rb
Overview
end
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.find_all_methods_like(method) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# 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 |
Instance Method Details
#instance_variable_set(var, *args) ⇒ Object
186 187 188 189 |
# 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) ⇒ Object
899 900 901 |
# 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) ⇒ Object
21 22 23 |
# File 'lib/rubyhacks.rb', line 21 def set(v, *args) send(v+"=".to_sym, *args) end |