Class: FactsDatabase
- Inherits:
-
Object
- Object
- FactsDatabase
- Defined in:
- lib/cirrocumulus/facts.rb
Overview
Adapter for facts database.
Instance Method Summary collapse
- #add(fact, options = {}) ⇒ Object
- #enumerate ⇒ Object
-
#initialize ⇒ FactsDatabase
constructor
A new instance of FactsDatabase.
- #remove(fact) ⇒ Object
Constructor Details
#initialize ⇒ FactsDatabase
Returns a new instance of FactsDatabase.
26 27 28 |
# File 'lib/cirrocumulus/facts.rb', line 26 def initialize @storage = [] end |
Instance Method Details
#add(fact, options = {}) ⇒ Object
30 31 32 |
# File 'lib/cirrocumulus/facts.rb', line 30 def add(fact, = {}) @storage << Fact.new(fact, Time.now, ) end |
#enumerate ⇒ Object
38 39 40 |
# File 'lib/cirrocumulus/facts.rb', line 38 def enumerate @storage.dup end |
#remove(fact) ⇒ Object
34 35 36 |
# File 'lib/cirrocumulus/facts.rb', line 34 def remove(fact) @storage.delete_if {|f| f.data == fact} end |