Class: Ruleby::Core::Fact
- Inherits:
-
Object
- Object
- Ruleby::Core::Fact
- Defined in:
- lib/core/engine.rb
Overview
A fact is an object that is stored in working memory. The rules in the system will either look for the existence or absence of particular facts.
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
-
#recency ⇒ Object
Returns the value of attribute recency.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
- #==(fact) ⇒ Object
- #id ⇒ Object
-
#initialize(object, token) ⇒ Fact
constructor
A new instance of Fact.
- #to_s ⇒ Object
Constructor Details
#initialize(object, token) ⇒ Fact
Returns a new instance of Fact.
107 108 109 110 |
# File 'lib/core/engine.rb', line 107 def initialize(object, token) @token = token @object = object end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
105 106 107 |
# File 'lib/core/engine.rb', line 105 def object @object end |
#recency ⇒ Object
Returns the value of attribute recency.
104 105 106 |
# File 'lib/core/engine.rb', line 104 def recency @recency end |
#token ⇒ Object
Returns the value of attribute token.
103 104 105 |
# File 'lib/core/engine.rb', line 103 def token @token end |
Instance Method Details
#==(fact) ⇒ Object
116 117 118 |
# File 'lib/core/engine.rb', line 116 def ==(fact) return fact != nil && fact.id == id end |
#id ⇒ Object
112 113 114 |
# File 'lib/core/engine.rb', line 112 def id return object.object_id end |
#to_s ⇒ Object
120 121 122 |
# File 'lib/core/engine.rb', line 120 def to_s return "[Fact |#{@recency}|#{@object.to_s}]" end |