Class: Object

Inherits:
BasicObject
Defined in:
lib/ruber/utils.rb,
lib/ruber/utils.rb

Instance Method Summary (collapse)

Instance Method Details

- (nil) debug(obj) Also known as: d

Prints the given object and the position from which the method was called

Parameters:

  • the (Object)

    object to print on screen (its inspect method will be used)

Returns:

  • (nil)


101
102
103
# File 'lib/ruber/utils.rb', line 101

def debug obj
  $stderr.puts "DEBUG(#{caller[0][/^[^:]+:\d+/]}): #{obj.inspect}\n"
end

- (Array) to_array

Encloses self in an array unless it’s already an array

Unlike Kernel#Array, this doesn’t use the to_ary or to_a methods

Returns:

  • (Array)

    self enclosed in an array



124
125
126
# File 'lib/ruber/utils.rb', line 124

def to_array
  [self]
end