Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/langtag.rb
Overview
:stopdoc:
Helper Functions for Array Class
Class Method Summary collapse
-
.collect(final = nil, &block) ⇒ Object
Create a new Array by repeatedly calling &block until the returned value is equal to final.
Instance Method Summary collapse
-
#uniq? ⇒ Boolean
Test uniqueness of elements of an Array.
Class Method Details
.collect(final = nil, &block) ⇒ Object
Create a new Array by repeatedly calling &block until the returned value is equal to final.
8 9 10 11 12 13 14 |
# File 'lib/langtag.rb', line 8 def Array.collect (final=nil, &block) a = Array.new while final != (e=block.call) a << e end a end |
Instance Method Details
#uniq? ⇒ Boolean
Test uniqueness of elements of an Array. This should be available as part of the standard Array class.
17 18 19 |
# File 'lib/langtag.rb', line 17 def uniq? return self.length == self.uniq.length end |