Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/langtag.rb

Overview

:stopdoc:

Helper Functions for Array Class

Class Method Summary collapse

Instance Method Summary collapse

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.

Returns:

  • (Boolean)


17
18
19
# File 'lib/langtag.rb', line 17

def uniq?
  return self.length == self.uniq.length
end