Class: Dbd::Context
Overview
A Context is derived from a Resource, and is the set of all ContextFacts that share the same subject.
It is pointed to by a context_subject of a Fact and has no context_subject itself (the context_subject relationship from Fact to ContextFact is not recursive).
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
-
#<<(context_fact_collection) ⇒ Context
Add a ContextFact (strictly only a ContextFact) or recursive collection of ContextFacts.
-
#initialize(options = {}) ⇒ Context
constructor
Build a new Context.
Methods inherited from Resource
Methods included from Helpers::OrderedSetCollection
add_and_return_index, #each, #freeze, #last, #size
Constructor Details
#initialize(options = {}) ⇒ Context
Build a new Context.
The subject can be either given as an argument or a new (random) subject is automatically set (see Resource for details).
A context_subject may not be given here.
19 20 21 |
# File 'lib/dbd/context.rb', line 19 def initialize( = {}) super end |
Instance Method Details
#<<(context_fact_collection) ⇒ Context
Add a ContextFact (strictly only a ContextFact) or recursive collection of ContextFacts
Side effect on the context_fact argument:
-
if it has no subject, the subject is set in the context_fact
-
if is has the same subject as the resource, added unchanged.
-
if it has a different subject, a SubjectError is raised.
NOTE: this implementation is really only here for the documentation
35 36 37 |
# File 'lib/dbd/context.rb', line 35 def <<(context_fact_collection) super end |