Class: Roast::Cog::Store

Inherits:
Object
  • Object
show all
Defined in:
lib/roast/cog/store.rb

Defined Under Namespace

Classes: CogAlreadyDefinedError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStore

: () -> void



15
16
17
# File 'lib/roast/cog/store.rb', line 15

def initialize
  @store = {}
end

Instance Attribute Details

#storeObject (readonly)

: Hash[Symbol, Cog]



12
13
14
# File 'lib/roast/cog/store.rb', line 12

def store
  @store
end

Instance Method Details

#insert(cog) ⇒ Object

: (Cog) -> Roast::Cog



20
21
22
23
24
# File 'lib/roast/cog/store.rb', line 20

def insert(cog)
  raise CogAlreadyDefinedError, cog.name if store.key?(cog.name)

  store[cog.name] = cog
end