Re: Ruby BuiltIn functions throw
throw( aSymbol [, anObject ] )
Transfers control to the end of the active catch block waiting for aSymbol. Raises NameError if there is no catch block for the symbol. The optional second parameter supplies a return value for the catch block, which otherwise defaults to nil. For examples, see Kernel::catch on page 413.
trace_var
trace_var( aSymbol, aCmd ) -> nil
trace_var( aSymbol ) {| val | block }-> nil
Controls tracing of assignments to global variables. The parameter aSymbol identifies the variable (as either a string name or a symbol identifier). cmd (which may be a string or a Proc object) or block is executed whenever the variable is assigned. The block or Proc object receives the variable's new value as a parameter. Also see Kernel::untrace_var .
trace_var :$_, proc {|v| puts "$_ is now '#{v}'" }
$_ = "hello"
$_ = ' there'
produces:
$_ is now 'hello'
$_ is now ' there'
__________________ Shaalini.S Be the Best of Whatever you are... |