Module: Kernel
- Defined in:
- lib/webget_ramp/kernel.rb
Class Method Summary collapse
-
.pp_s(*objs) ⇒ Object
Pretty print to a string.
Instance Method Summary collapse
-
#method_name(caller_index = 0) ⇒ Object
See: - www.ruby-forum.com/topic/75258 - In 1.9 (Ruby CVS HEAD) there is #__method__ and #__callee__ - eigenclass.org/hiki.rb?Changes+in+Ruby+1.9#l90.
Class Method Details
.pp_s(*objs) ⇒ Object
Pretty print to a string.
Created by Graeme Mathieson.
See rha7dotcom.blogspot.com/2008/07/ruby-and-rails-how-to-get-pp-pretty.html
23 24 25 26 27 28 29 30 |
# File 'lib/webget_ramp/kernel.rb', line 23 def pp_s(*objs) s = StringIO.new objs.each {|obj| PP.pp(obj, s) } s.rewind s.read end |
Instance Method Details
#method_name(caller_index = 0) ⇒ Object
See:
-
In 1.9 (Ruby CVS HEAD) there is #__method__ and #__callee__
11 12 13 14 15 |
# File 'lib/webget_ramp/kernel.rb', line 11 def method_name(caller_index=0) # Make this fast because its often doing logging & reporting. # Inline this and use $1 because it's empirically faster than /1 caller[caller_index] =~ /`([^']*)'/ and $1 end |