Sha256: 582ba1d2408d27d68b52ce748dffc1ac9f95ef973258407077984ffbaf6308dc
Contents?: true
Size: 569 Bytes
Versions: 1
Compression:
Stored size: 569 Bytes
Contents
require 'nano/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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
facets-0.9.0 | lib/nano/binding/called.rb |