Sha256: 6426af313c4b922c26d158e6f4d0fc3476bec4b8f711a1290a98184d9b7179ee

Contents?: true

Size: 557 Bytes

Versions: 1

Compression:

Stored size: 557 Bytes

Contents

require "binding_of_callers/version"
require 'binding_of_callers/revealed'
require 'binding_of_caller'

class Binding

  def of_callers(fc = frame_count)
    enhance(fc) do |bi|
      BindingOfCallers::Revealed.new bi
    end
  end

  def of_callers!(fc = frame_count)
    enhance(fc) do |bi|
      bi.extend BindingOfCallers::Reveal
    end
  end

  private

  def enhance(fc, &enhance)
    collected(fc).map(&enhance)
  end

  def collected(fc)
    n = 3
    bis = []
    while n < fc
      bis << of_caller(n)
      n = n.succ
    end
    bis
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
binding_of_callers-0.2.1 lib/binding_of_callers.rb