In (my) ruby 1.9.2 class Array has an undocumented method #one? . It
takes no arguments and returns true if the array contains one element,
false otherwise. Is this something someone forgot to delete?
On Oct 30, 2010, at 4:45 PM, Siep Korteling wrote:
In (my) ruby 1.9.2 class Array has an undocumented method #one? . It
takes no arguments and returns true if the array contains one element,
false otherwise. Is this something someone forgot to delete?
------------------------------------------------------------------------------
enum.one? [{|obj| block }] => true or false
Passes each element of the collection to the given block. The method returns
true if the block returns true exactly once. If the block is not
given, one? will return true only if exactly one of the
collection members is true.
On Oct 30, 2010, at 4:45 PM, Siep Korteling wrote:
In (my) ruby 1.9.2 class Array has an undocumented method #one? . It
takes no arguments and returns true if the array contains one element,
false otherwise. Is this something someone forgot to delete?
Passes each element of the collection to the given block. The method
returns
true if the block returns true exactly once. If the block is not
given, one? will return true only if exactly one of the
collection members is true.