Class: Fact
- Inherits:
-
Object
- Object
- Fact
- Defined in:
- lib/cirrocumulus/facts.rb
Overview
Fact (piece of knowledge) representation. It holds time when it was observed (added to facts database) and expire time in seconds.
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#is_deleted ⇒ Object
Returns the value of attribute is_deleted.
Instance Method Summary collapse
-
#initialize(data, time, options) ⇒ Fact
constructor
A new instance of Fact.
- #timed_out? ⇒ Boolean
Constructor Details
#initialize(data, time, options) ⇒ Fact
Returns a new instance of Fact.
6 7 8 9 10 11 |
# File 'lib/cirrocumulus/facts.rb', line 6 def initialize(data, time, ) @data = data @time = time @options = @is_deleted = false end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
13 14 15 |
# File 'lib/cirrocumulus/facts.rb', line 13 def data @data end |
#is_deleted ⇒ Object
Returns the value of attribute is_deleted.
14 15 16 |
# File 'lib/cirrocumulus/facts.rb', line 14 def is_deleted @is_deleted end |
Instance Method Details
#timed_out? ⇒ Boolean
16 17 18 19 |
# File 'lib/cirrocumulus/facts.rb', line 16 def timed_out? return false if @options[:expires] == nil @time + @options[:expires] < Time.now end |