Sha256: d7465baf6cc5d009008d2f82a2f52051d8783a88995636a70bf82eeba1e144fb
Contents?: true
Size: 463 Bytes
Versions: 4
Compression:
Stored size: 463 Bytes
Contents
# example.rb require 'stack_frames' STACK_FRAMES_BUFFER = StackFrames::Buffer.new(2) CAPTURE_CALLER = -> { STACK_FRAMES_BUFFER.capture } def foo(&block) yield end foo(&CAPTURE_CALLER) caller_frame = STACK_FRAMES_BUFFER[1] p caller_frame.path # => "example.rb" p caller_frame.lineno # => 14 p caller_frame.method_name # => "foo" puts CAPTURE_CALLER.call p caller_frame.path # => "example.rb" p caller_frame.lineno # => 18 p caller_frame.method_name # => nil
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
stack_frames-0.1.3 | example.rb |
stack_frames-0.1.2 | example.rb |
stack_frames-0.1.1 | example.rb |
stack_frames-0.1.0 | example.rb |