Browse files

Enumerator isn't at the top level in 1.8.7

  • Loading branch information...
1 parent 9b2b58f commit e55c02291551668bde1b81d7c42809e4c6641231 @drbrain committed Mar 25, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/pasteboard.rb
View
5 lib/pasteboard.rb
@@ -67,7 +67,10 @@ def [] index, flavor = nil
# See #[] for a description of an item.
def each flavor = nil # :yields: item
- return Enumerator.new(self, :each, flavor) unless block_given?
+ unless block_given? then
+ enum = defined?(Enumerator) ? Enumerator : Enumerable::Enumerator # 1.8.7
+ return enum.new(self, :each, flavor)
+ end
flags = sync

0 comments on commit e55c022

Please sign in to comment.