Module: IsACollection::ClassMethods

Defined in:
lib/is_a_collection.rb

Instance Method Summary collapse

Instance Method Details

#__collectionObject



60
61
62
# File 'lib/is_a_collection.rb', line 60

def __collection
  @__collection ||= {}
end

#__indicesObject



73
74
75
# File 'lib/is_a_collection.rb', line 73

def __indices
  @__indices ||= Hash.new{ |hash,key| hash[key] = Hash.new{ |hash1,key1| hash1[key1] = Set.new } }
end

#allObject



63
64
65
# File 'lib/is_a_collection.rb', line 63

def all
  __collection.values
end

#clear_collection_indicesObject



69
70
71
72
# File 'lib/is_a_collection.rb', line 69

def clear_collection_indices
  @__collection = {}
  @__indices = Hash.new{ |hash,key| hash[key] = Hash.new{ |hash1,key1| hash1[key1] = Set.new } }
end

#find(identifier) ⇒ Object



66
67
68
# File 'lib/is_a_collection.rb', line 66

def find(identifier)
  __collection[identifier]
end