Sha256: fbf9189b6df1464eb912a6f77cd59bb373a9807e0a516ef89ad3c701442e87d3

Contents?: true

Size: 588 Bytes

Versions: 1

Compression:

Stored size: 588 Bytes

Contents

require 'after_do'

module M
  def method
  end
end

class A
  include M
end

class B
  include M
end

class C
  include M

  def method
    puts 'Overridden method'
  end
end

class D
  prepend M

  def method
    puts 'Wanna be Overriden method'
  end
end

M.extend AfterDo
M.after :method do puts 'method called' end

A.new.method
B.new.method

# won't call callback since the implementation was overriden
C.new.method

# will call callback since the module extending AfterDo was prepended
D.new.method

# Output is:
# method called
# method called
# Overridden method
# method called

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
after_do-0.4.0 samples/with_module.rb