Sha256: 6eeb5189bf129a4323a581e0f4978bcfa97284890b40b0b25f27a95e442ddf4c

Contents?: true

Size: 710 Bytes

Versions: 1

Compression:

Stored size: 710 Bytes

Contents

require 'nano/module/rename'
require 'nano/module/redef'
require 'nano/module/remove'
require 'nano/module/undef'
require 'nano/module/wrap'

class Module

  def revisal( &blk )
    base = self
    nm = Module.new { include base }
    nm.class_eval &blk
    nm
  end

end



#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#

=begin testing

  require 'test/unit'

  class TCModule < Test::Unit::TestCase
    module M
      def x ; 1 ; end
    end
    class C
      include M.revisal {
        rename :y, :x
      }
    end

    def test_001
      c = C.new
      assert_raises( NoMethodError ) { c.x }
      assert_equal( 1, c.y )
    end
  end

=end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facets-0.9.0 lib/nano/module/revisal.rb