Skip to content

Commit

Permalink
Remove definition of Array#all?
Browse files Browse the repository at this point in the history
I don't know why core_ext defines Array#all? since Enumerable#all? does the same thing (in MRI 1.8.7 and 1.9.3)

Except that this extension doesn't support the behaviour that "If the block is not given, Ruby adds an implicit block of {|obj| obj} (that is all? will return true only if none of the collection members are false or nil.)" http://www.ruby-doc.org/core-1.9.3/Enumerable.html#method-i-all-3F 

So with this definition, including ruby-graphviz breaks any existing code that calls an_array.all? without a block.

And without this local extension, the tests seem to pass anyway (again, in MRI 1.8.7 and 1.9.3).
  • Loading branch information
ronen committed Dec 11, 2011
1 parent 2499240 commit fe8338c
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions lib/graphviz/core_ext.rb
Expand Up @@ -23,15 +23,6 @@ def to_ruby
end
end

class Array
def all?(&b)
r = self.delete_if { |x|
yield x
}
r.size == 0
end
end

# From : http://www.geekmade.co.uk/2008/09/ruby-tip-normalizing-hash-keys-as-symbols/
class Hash
def symbolize_keys
Expand Down

0 comments on commit fe8338c

Please sign in to comment.