Permalink
Browse files

Improve documentation

Move return_bang/kernel to return_bang/everywhere
  • Loading branch information...
1 parent 815dd4d commit bc778873571c5600b2e902400fd6dc1571bf6dc8 @drbrain committed Dec 21, 2011
Showing with 31 additions and 22 deletions.
  1. +1 −1 Manifest.txt
  2. +14 −13 README.rdoc
  3. +1 −0 Rakefile
  4. +8 −2 lib/return_bang.rb
  5. +7 −0 lib/return_bang/everywhere.rb
  6. +0 −6 lib/return_bang/kernel.rb
View
@@ -4,5 +4,5 @@ Manifest.txt
README.rdoc
Rakefile
lib/return_bang.rb
-lib/return_bang/kernel.rb
+lib/return_bang/everywhere.rb
test/test_return_bang.rb
View
@@ -12,22 +12,14 @@ enemies *and* your friends! What could possibly go wrong?
== Features
-* Implements non-local exits for named and stack-based exit points
-* Uses continuations
-* Ignores pesky ensure blocks
-
-== Testimonials
-
-"you'll wind up with your cock in /dev/null somehow"
-
-"Haha! Right! This skips ensure… SO EVIL‼‼"
-
-"This is so evil that 6 def test_… have turned into: 16 tests, 65 assertions,
-18 failures, 7 errors"
+* Implements non-local exits for methods
+* Nestable
+* Named and stack-based exit points, go exactly where you need to be
+* Ignores pesky ensure blocks for when you really, really need to return
== Synopsis
- require 'return_bang/kernel'
+ require 'return_bang/everywhere'
def some_method
deeply_nested
@@ -43,6 +35,15 @@ enemies *and* your friends! What could possibly go wrong?
end
# resumes here
+== Testimonials
+
+"you'll wind up with your cock in /dev/null somehow" -- slyphon
+
+"Haha! Right! This skips ensure… SO EVIL‼‼" -- drbrain
+
+"This is so evil that 6 def test_… have turned into: 16 tests, 65 assertions,
+18 failures, 7 errors" -- drbrain
+
== Install
sudo gem install return_bang
View
@@ -12,6 +12,7 @@ Hoe.spec 'return_bang' do
rdoc_locations << 'docs.seattlerb.org:/data/www/docs.seattlerb.org/return_bang/'
self.readme_file = 'README.rdoc'
+ self.extra_rdoc_files << 'README.rdoc'
end
# vim: syntax=ruby
View
@@ -13,8 +13,14 @@
# points may be arbitrarily nested. #return! resumes at the previous resume
# point, #return_to returns to a named return point.
#
+# require 'return_bang' gives you a module you may include only in your
+# application or library code. require 'return_bang/everywhere' includes
+# ReturnBang in Object, so it is only recommended for application code use.
+#
# Example:
#
+# include ReturnBang
+#
# def framework_loop
# loop do
# # setup code
@@ -61,15 +67,15 @@ def _return_bang_names # :nodoc:
Thread.current[:return_bang_names] ||= {}
end
- if {}.respond_to? :key then
+ if {}.respond_to? :key then # 1.9
def _return_bang_pop # :nodoc:
return_point = _return_bang_stack.pop
_return_bang_names.delete _return_bang_names.key _return_bang_stack.length
return_point
end
- else
+ else # 1.8
def _return_bang_pop # :nodoc:
return_point = _return_bang_stack.pop
value = _return_bang_stack.length
@@ -0,0 +1,7 @@
+require 'return_bang'
+
+##
+# require 'return_bang/kernel' adds #return! to all objects
+
+include ReturnBang
+
@@ -1,6 +0,0 @@
-require 'return_bang'
-
-module Kernel
- include ReturnBang
-end
-

0 comments on commit bc77887

Please sign in to comment.