README.rdoc in sender-1.3 vs README.rdoc in sender-1.4
- old
+ new
@@ -26,71 +26,116 @@
* sudo gem install sender
== EXAMPLE:
- require 'sender'
-
require '../sender/lib/sender/sender'
require 'pp'
class Test
-
+
+ def initialize
+ puts 'In method <Test>:initialize'
+ puts 'Sender was: ' + __sender__.pretty_inspect.to_s
+ puts 'Caller was: ' + __caller__.to_s
+ end
+
def test
+ puts 'In <Test>:test'
self.another_test
end
-
+
def another_test
+ puts 'In method <Test>:another_test'
test2 = Test2.new
test2.and_another_test_in_another_object
end
-
+
end
class Test2
-
+
+ def initialize
+ puts 'In method <Test2>:initialize'
+ puts 'Sender was: ' + __sender__.pretty_inspect.to_s
+ puts 'Caller was: ' + __caller__.to_s
+ end
+
def and_another_test_in_another_object
+ puts 'In method <Test2>:and_another_test_in_another_object'
+ pp self
puts 'Sender was: ' + __sender__.pretty_inspect.to_s
puts 'Caller was: ' + __caller__.to_s
pp Kernel.backtrace
pp Kernel.backtrace( 2 )
puts 'These should be true:'
pp Kernel.backtrace_includes?( :another_test )
pp Kernel.backtrace_includes?( Test )
pp Kernel.backtrace_includes?( $test )
pp Kernel.backtrace_includes?( :another_test, Test, $test )
puts 'These should be false:'
- pp Kernel.backtrace_includes?( :non_existing_function )
+ pp Kernel.backtrace_includes?( :yet_another_test )
pp Kernel.backtrace_includes?( Test2 )
pp Kernel.backtrace_includes?( self )
- pp Kernel.backtrace_includes?( :non_existing_function, Test2, self )
+ pp Kernel.backtrace_includes?( :yet_another_test, Test2, self )
end
-
+
end
$test = Test.new
$test.test
+
+ puts 'Finished Test.'
+ exit
== EXAMPLE's OUTPUT:
- Sender was: #<Test:0x0000010101ef18>
- Caller was: and_another_test_in_another_object
- [{:object=>#<Test:0x0000010101ef18>, :method=>:another_test},
- {:object=>#<Test:0x0000010101ef18>, :method=>:test},
- {:object=>main}]
- [{:object=>#<Test:0x0000010101ef18>, :method=>:another_test},
- {:object=>#<Test:0x0000010101ef18>, :method=>:test}]
+ In method <Test>:initialize
+ Sender was: main
+ Caller was: <main>
+ In <Test>:test
+ In method <Test>:another_test
+ In method <Test2>:initialize
+ Sender was: #<Test:0x0000010180ddf8>
+ Caller was: another_test
+ In method <Test2>:and_another_test_in_another_object
+ #<Test2:0x0000010180b158>
+ Sender was: #<Test:0x0000010180ddf8>
+ Caller was: another_test
+ [{:object=>#<Test2:0x0000010180b158>,
+ :file=>"sender_test.rb",
+ :line=>39,
+ :method=>"and_another_test_in_another_object"},
+ {:object=>#<Test:0x0000010180ddf8>,
+ :file=>"sender_test.rb",
+ :line=>21,
+ :method=>"another_test"},
+ {:object=>#<Test:0x0000010180ddf8>,
+ :file=>"sender_test.rb",
+ :line=>15,
+ :method=>"test"},
+ {:object=>main, :file=>"sender_test.rb", :line=>56, :method=>"<main>"},
+ {:object=>main, :file=>"<main>", :line=>0, :method=>"<main>"}]
+ [{:object=>#<Test2:0x0000010180b158>,
+ :file=>"sender_test.rb",
+ :line=>40,
+ :method=>"and_another_test_in_another_object"},
+ {:object=>#<Test:0x0000010180ddf8>,
+ :file=>"sender_test.rb",
+ :line=>21,
+ :method=>"another_test"}]
These should be true:
true
true
true
true
These should be false:
false
false
false
false
+ Finished Test.
== LICENSE:
(The MIT License)
\ No newline at end of file