Module: Kernel

Defined in:
lib/ruber/utils.rb

Instance Method Summary collapse

Instance Method Details

#obj_bindingBinding

Returns the binding of the object.

Returns:

  • (Binding)

    the binding of the object



69
70
71
# File 'lib/ruber/utils.rb', line 69

def obj_binding
  binding
end

#silently { ... } ⇒ Object

Executes the body of the block without emitting warnings

This method sets the @$VERBOSE@ global variable to nil (which disables warnings) before calling the block and restores it to the original value after executing the block (even if the block raises an exception)

Yields:

Returns:

  • (Object)

    the value returned by the block



84
85
86
87
88
89
90
# File 'lib/ruber/utils.rb', line 84

def silently
  old_verbose, $VERBOSE = $VERBOSE, nil
  begin yield
  ensure
    $VERBOSE = old_verbose
  end
end

#string_like?Boolean

Whether an object is similar to a string currently it returns true for strings and symbol and false for all other objects.

Returns:

  • (Boolean)

    true if the object is similar to a string and false otherwise. In particular



62
63
64
# File 'lib/ruber/utils.rb', line 62

def string_like?
  false
end