Sha256: 39c13458d52172bec6ba3b002be6726ae2e27a12610e7978ee022c196c2741d4

Contents?: true

Size: 724 Bytes

Versions: 1

Compression:

Stored size: 724 Bytes

Contents

NAME
  redef.rb

DESCRIPTION
  a sane way to redefine methods in ruby

INSTALL
  gem install redef

SAMPLES

  <========< samples/a.rb >========>

  ~ > cat samples/a.rb

    # redef is a super simple way to robustly override methods - providing the
    # POLS method of referring to the previous method as (wait for it) super.
    # it's really that simple
    #
      require 'redef'
    
      class C
        def foo() 30 end
    
        p C.new.foo  #=> 30
    
        redef do 
          def foo() super + 2 end
        end
    
        p C.new.foo #=> 32
    
        redef do 
          def foo() super + 10 end
        end
    
        p C.new.foo #=> 42
      end

  ~ > ruby samples/a.rb

    30
    32
    42

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
redef-0.4.2 README