Sha256: e9dd6ac15016571ed1e648bc86eb020c68a8f0a88ab085a855c59fb0b54da4c8
Contents?: true
Size: 570 Bytes
Versions: 3
Compression:
Stored size: 570 Bytes
Contents
require 'facet/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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
facets-1.0.0 | lib/facet/binding/called.rb |
facets-1.0.3 | packages/core/lib/facet/binding/called.rb |
facets-1.1.0 | lib/facet/binding/called.rb |