Module: Factis
- Defined in:
- lib/factis.rb,
lib/factis/memory.rb,
lib/factis/version.rb,
lib/generators/factis/rspec_generator.rb,
lib/generators/factis/cucumber_generator.rb
Overview
This module contains syntactic sugar for the methods in Factis::Memory. The purpose is, basically, to make the methods easily injected into, say, Cucumber via extend.
Defined Under Namespace
Modules: Generators Classes: Memory
Constant Summary collapse
- VERSION =
'1.0.1'
Instance Method Summary collapse
-
#all_facts ⇒ Hash
Returns the entire facts hash.
-
#clear_all_facts! ⇒ Object
Forget all of the known facts.
-
#forget_fact(fact) ⇒ Object
Removes the given fact (key) from internal storage, raising an error for an unknown fact.
-
#indifferently_memorize_fact(fact, content) ⇒ Object
This method is equivalent to memorize_fact in all ways, save that it disregards the possible existence of the fact key within the internal hash.
-
#memorize_fact(fact, content) ⇒ Object
Memorize the given content, keyed by the given fact key.
-
#recall_fact(fact) ⇒ Object
Get fact content by key, raising an error for an unknown fact.
Instance Method Details
#all_facts ⇒ Hash
Returns the entire facts hash
20 21 22 |
# File 'lib/factis.rb', line 20 def all_facts Factis::Memory.all_facts end |
#clear_all_facts! ⇒ Object
Forget all of the known facts
12 13 14 |
# File 'lib/factis.rb', line 12 def clear_all_facts! Factis::Memory.reset! end |
#forget_fact(fact) ⇒ Object
Removes the given fact (key) from internal storage, raising an error for an unknown fact
64 65 66 |
# File 'lib/factis.rb', line 64 def forget_fact(fact) Factis::Memory.forget(fact) end |
#indifferently_memorize_fact(fact, content) ⇒ Object
This undermines the goal of safely tracking state. Please refrain from using it if at all possible.
This method is equivalent to memorize_fact in all ways, save that it disregards the possible existence of the fact key within the internal hash.
45 46 47 |
# File 'lib/factis.rb', line 45 def indifferently_memorize_fact(fact, content) Factis::Memory.memorize(fact, content, :overwrite => true) end |
#memorize_fact(fact, content) ⇒ Object
Memorize the given content, keyed by the given fact key. This wrapper does not allow for overwriting of a fact, and an atttempt to do so will raise an error.
33 34 35 |
# File 'lib/factis.rb', line 33 def memorize_fact(fact, content) Factis::Memory.memorize(fact, content) end |