Class: Cirrocumulus::Ruler::Fact

Inherits:
Object
  • Object
show all
Defined in:
lib/cirrocumulus/rules/fact.rb

Overview

Fact. Piece of information, collected and operated in Cirrocumulus. We also remember the time, when this fact was created (observed). Optionally can have expiration time

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, time, options) ⇒ Fact

Returns a new instance of Fact.



10
11
12
13
14
# File 'lib/cirrocumulus/rules/fact.rb', line 10

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

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



7
8
9
# File 'lib/cirrocumulus/rules/fact.rb', line 7

def data
  @data
end

#is_deletedObject

Returns the value of attribute is_deleted.



8
9
10
# File 'lib/cirrocumulus/rules/fact.rb', line 8

def is_deleted
  @is_deleted
end

Instance Method Details

#expired?Boolean

Returns:

  • (Boolean)


16
17
18
19
# File 'lib/cirrocumulus/rules/fact.rb', line 16

def expired?
  return false if @options[:expires] == nil
  @time + @options[:expires] < Time.now
end