Sha256: f6bd4395b9c1d786d55416e8d2457a7efd047eeb08274f0f1964e503f015e5db
Contents?: true
Size: 577 Bytes
Versions: 22
Compression:
Stored size: 577 Bytes
Contents
require 'facets/core/binding/caller' class Binding # Retreive the current running method. # # def tester; p called; end # tester #=> :tester # def called name = /\`([^\']+)\'/.match(caller(1).first)[1] return name.to_sym end end # _____ _ # |_ _|__ ___| |_ # | |/ _ \/ __| __| # | | __/\__ \ |_ # |_|\___||___/\__| # =begin test require 'test/unit' class TCBinding < Test::Unit::TestCase def setup @bind = binding end def test_called assert_equal( :setup, @bind.called ) end end =end
Version data entries
22 entries across 22 versions & 1 rubygems