Module: Kernel
- Defined in:
- lib/ruber/utils.rb
Instance Method Summary collapse
-
#obj_binding ⇒ Binding
The binding of the object.
-
#silently { ... } ⇒ Object
Executes the body of the block without emitting warnings.
-
#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.
Instance Method Details
#obj_binding ⇒ Binding
Returns 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)
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.
62 63 64 |
# File 'lib/ruber/utils.rb', line 62 def string_like? false end |