Sha256: a8fc3ece1bb3917a0ec1bd9803f9179b3c7208be0fab28d6d84791a6b9d94748

Contents?: true

Size: 725 Bytes

Versions: 1

Compression:

Stored size: 725 Bytes

Contents

require "procemon"

class TestT

  def self.test
    puts self
  end

  def test string
    puts self,string
  end

end

TestT.hook_instance_method :test do |*args|
  puts "before hook and str: " + args[0].to_s.inspect
end

TestT.hook_singleton_method :test, add: "after" do

  puts "after hook for singleton"

end

puts "\n\n",
     "after,singleton case:",
     "---------------------"
TestT.test

puts "\n\n",
     "before,instance case:",
     "---------------------"
TestT.new.test "boogie man"

puts "\n"


# after,singleton case:
# ---------------------
# TestT
# after hook for singleton
#
#
# before,instance case:
# ---------------------
# before hook and str: "boogie man"
# #<TestT:0x000000027bebc8>
# boogie man

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
procemon-2.0.0 examples/test.rb