Sha256: 52bc639a20f51b376bb04782747ef8b0b6cd18bfe5c8a2a40274fdc6c65ad975

Contents?: true

Size: 577 Bytes

Versions: 1

Compression:

Stored size: 577 Bytes

Contents

require 'nano/binding/eval'

class Binding

  # Returns the self in the binding context.
  def self()
    @self ||= eval( "self" )
    @self
  end

end


#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
=begin test

  require 'test/unit'

  class TCBinding < Test::Unit::TestCase

    def setup
      a = 1
      b = 2
      x = "hello"
      # the line number must be updated if it moves
      @bind = binding; @this_line_no = 25
    end

    def test_self
      assert_equal( self, @bind.self )
    end

  end

=end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facets-0.9.0 lib/nano/binding/self.rb