Class: Roast::Cog::Store
- Inherits:
-
Object
- Object
- Roast::Cog::Store
- Defined in:
- lib/roast/cog/store.rb
Defined Under Namespace
Classes: CogAlreadyDefinedError
Instance Attribute Summary collapse
-
#store ⇒ Object
readonly
: Hash[Symbol, Cog].
Instance Method Summary collapse
-
#initialize ⇒ Store
constructor
: () -> void.
-
#insert(cog) ⇒ Object
: (Cog) -> Roast::Cog.
Constructor Details
#initialize ⇒ Store
: () -> void
15 16 17 |
# File 'lib/roast/cog/store.rb', line 15 def initialize @store = {} end |
Instance Attribute Details
#store ⇒ Object (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 |