From: Matthew Kerwin Date: 2013-05-19T07:35:08+09:00 Subject: Re: Need help for Kernel methods --14dae93d8c861227bb04dd05b6e8 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On May 18, 2013 8:33 PM, "Love U Ruby" wrote: > > From the doc: > http://www.ruby-doc.org/core-2.0/Kernel.html#method-i-caller_locations > > caller_locations(start=3D1, length=3Dnil) =E2=86=92 array or nil click to= toggle > source > caller_locations(range) =E2=86=92 array or nil > > *Returns the current execution stack=E2=80=94an array containing backtrac= e > location objects. > > *The optional start parameter determines the number of initial stack > entries to omit from the top of the stack. > > *A second optional length parameter can be used to limit how many > entries are returned from the stack. > > *Returns nil if start is greater than the size of current execution > stack. > > Could anyone give me small snippets to understand this methods? > > Thanks How about just run it in irb? If you don't know what a call stack is, this isn't the method for you. Hint: define a function that calls it. Then define a function that calls the first function. --14dae93d8c861227bb04dd05b6e8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

On May 18, 2013 8:33 PM, "Love U Ruby" <lists@ruby-forum.com> wrote:
>
> From the doc:
> http://www.ruby-doc.org/core-2.0/Kernel.html#method-i-caller_l= ocations
>
> caller_locations(start=3D1, length=3Dnil) =E2=86=92 array or nil click= to toggle
> source
> caller_locations(range) =E2=86=92 array or nil
>
> *Returns the current execution stack=E2=80=94an array containing backt= race
> location objects.
>
> *The optional start parameter determines the number of initial stack > entries to omit from the top of the stack.
>
> *A second optional length parameter can be used to limit how many
> entries are returned from the stack.
>
> *Returns nil if start is greater than the size of current execution > stack.
>
> Could anyone give me small snippets to understand this methods?
>
> Thanks

How about just run it in irb? If you don't know what a call stack is= , this isn't the method for you.

Hint: define a function that calls it. Then define a function that calls= the first function.

--14dae93d8c861227bb04dd05b6e8--