Class: Array

Inherits:
Object show all
Defined in:
lib/freighthopper/array/exclude.rb,
lib/freighthopper/array/symbols.rb,
lib/freighthopper/array/singular.rb

Instance Method Summary collapse

Instance Method Details

#exclude?(item) ⇒ Boolean

Returns:

  • (Boolean)


2
# File 'lib/freighthopper/array/exclude.rb', line 2

def exclude?(item) ! include? item end

#singularObject



3
# File 'lib/freighthopper/array/singular.rb', line 3

def singular() singular?? first : nil end

#singular!Object



4
# File 'lib/freighthopper/array/singular.rb', line 4

def singular!() singular or raise "not singular" end

#singular?Boolean

Returns:

  • (Boolean)


2
# File 'lib/freighthopper/array/singular.rb', line 2

def singular?() size == 1 end

#symbolsObject



2
# File 'lib/freighthopper/array/symbols.rb', line 2

def symbols() map {|x| x.to_sym} end