Browse files

Include output in examples file.

  • Loading branch information...
1 parent b33175c commit f4d608fd18a670a25ea266b757f0cf62905fbde2 @mynyml committed Apr 2, 2009
Showing with 10 additions and 3 deletions.
  1. +10 −3 examples.rb
View
13 examples.rb
@@ -1,25 +1,32 @@
-require 'pathname'
-root = Pathname(__FILE__).dirname.expand_path
-require root.join('lib/every.rb')
+require 'lib/every'
enum = [1.4, 2.4 ,3.4]
puts enum.every.floor.inspect
+#=> [1, 2, 3]
enum = %w( axb dxf )
puts enum.every.gsub(/x/) { 'y' }.inspect
+#=> ["ayb", "dyf"]
enum = %w( foo bar )
enum.every.upcase!
puts enum.inspect
+#=> ["FOO", "BAR"]
enum = %w( foo bar ) << ''
puts enum.every.empty?.all?
+#=> false
puts enum.every.empty?.any?
+#=> true
enum = %w( foo bar baz )
puts enum.select_every.match(/^ba/).inspect
+#=> ["bar", "baz"]
puts enum.reject_every.match(/^ba/).inspect
+#=> ["foo"]
enum = [1.4, 2.4 ,3.4]
puts (enum.select_every > 1.5).inspect
+#=> [2.4, 3.4]
puts (enum.reject_every > 2.5).inspect
+#=> [1.4, 2.4]

0 comments on commit f4d608f

Please sign in to comment.