Permalink
Browse files

a better readme, and the example on the correct place. The gem is coming

  • Loading branch information...
1 parent 5233fe6 commit 176d36f56148981be9cdc6391c9c5f440707fb82 @danielribeiro committed Nov 6, 2010
Showing with 18 additions and 11 deletions.
  1. +18 −0 README.md
  2. +0 −11 lib/example.rb
View
@@ -29,7 +29,25 @@ parenthesis. [More info](http://metaphysicaldeveloper.wordpress.com/2010/10/31/r
Quick Example
----
+The example consists of getting all instance methods of String, Array, Class that end with 'd?'
+ require 'ruby_underscore'
+
+ class MethodFinder
+ include RubyUnderscore::Base
+
+ def find_interrogation_methods
+ [String, Array, Class].map(_.public_instance_methods.grep /d\?$/).flatten.sort.uniq
+ end
+ end
+ p MethodFinder.new.find_interrogation_methods
+
+
+Using Ruby Underscore
+----
+As in the example above, simply by including the module include RubyUnderscore::Base on the
+class, all methods (class methods as well) will allow you to use the underscore symbol to
+write simple blocks.
Meta
View
@@ -1,11 +0,0 @@
-#!/usr/bin/env ruby
-require 'ruby_underscore'
-
-class MethodFinder
- include RubyUnderscore::Base
-
- def find_interrogation_methods
- [String, Array, Class].map(_.public_instance_methods.grep /\?$/).inject :+
- end
-end
-p MethodFinder.new.find_interrogation_methods.sort.uniq

0 comments on commit 176d36f

Please sign in to comment.