Class: Array

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

Direct Known Subclasses

Root::Processes

Instance Method Summary collapse

Instance Method Details

#has?(something) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
# File 'lib/sub/array.rb', line 8

def has?(something)
  self.each do |item|
    return true if item == something
  end
  false
end

#subtract(other) ⇒ Object



2
3
4
5
6
# File 'lib/sub/array.rb', line 2

def subtract(other)
  self.select do |item|
    !other.has?(item)
  end
end