Module: Kernel

Defined in:
lib/webget_ramp/kernel.rb

Class Method Summary collapse

Instance Method Summary collapse

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:



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