Class: Fleet::ItemSet

Inherits:
Set
  • Object
show all
Defined in:
lib/fleet/item_set.rb

Direct Known Subclasses

Cluster

Instance Method Summary collapse

Instance Method Details

#add_or_find(obj) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/fleet/item_set.rb', line 3

def add_or_find(obj)
  res = self.detect { |member| member == obj }
  if res
    res
  else
    add(obj)
    obj
  end
end