Sha256: dcd8d15cadb4f82c2c8394044780f7b3e035a1b126eb349ff0d490e111107d84

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

#!/usr/bin/env ruby

#    Copyright (c) 2007, Lin Jen-Shin(a.k.a. godfat 真常)
#
#    Licensed under the Apache License, Version 2.0 (the "License");
#    you may not use this file except in compliance with the License.
#    You may obtain a copy of the License at
#
#        http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.

begin
  require_ludy 'callstack'
rescue NameError
  raise LoadError.new('please require "ludy" first')
end

module Ludy
  def this
    info = callstack(-2)
    # lambda{ |*args|
      # Thread.current[:temp_args] = args
      # eval("send :#{info[3]}, *Thread.current[:temp_args]", info[4])
    # }
    eval('self', info[TRACE_BINDING]).method(info[TRACE_MSG])
  end
  module_function :this
end # of Ludy

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ludy-0.0.3 lib/ludy/this.rb
ludy-0.0.5 lib/ludy/this.rb
ludy-0.0.4 lib/ludy/this.rb