Class: Fact

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(data, time, options) ⇒ Fact



6
7
8
9
10
11
# File 'lib/cirrocumulus/facts.rb', line 6

def initialize(data, time, options)
@data = data
  @time = time
  @options = options
@is_deleted = false
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



13
14
15
# File 'lib/cirrocumulus/facts.rb', line 13

def data
  @data
end

#is_deletedObject

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