this repo has no description
at main 750 B view raw
1if defined?(IRB) 2 IRB.conf[:AUTO_INDENT] = true 3end 4 5Dir[File.expand_path("~/.irbd/*.rb")].each{|f| require f } 6 7module Kernel 8 def pbpaste 9 `pbpaste` 10 end 11 12 def pbcopy(object) 13 IO.popen('pbcopy', 'w') { |pb| pb << object.to_s } 14 end 15 16 def pbfilter(filter) 17 pbcopy pbpaste.split("\n").select{|l| l =~ filter }.join("\n") 18 end 19end 20 21class Object 22 def local_methods 23 self.methods.tap do |methods| 24 self.class.ancestors.each do |ancestor| 25 next if ancestor == self.class 26 methods -= ancestor.instance_methods 27 end 28 end.sort 29 end 30end 31 32module Enumerable 33 def histogram(&block) 34 h = Hash.new(0) 35 each do |entry| 36 key = block_given? ? yield(entry) : entry 37 h[key] += 1 38 end 39 h 40 end 41end