Class: Observed::FakeSystem

Inherits:
Object
  • Object
show all
Defined in:
lib/observed/observed_task_factory.rb

Overview

An yet another cushion from the deprecated plugin interface to the new plugin interface

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ FakeSystem

Returns a new instance of FakeSystem.



10
11
12
# File 'lib/observed/observed_task_factory.rb', line 10

def initialize(args)
  @time = args[:time] || Time.now
end

Instance Method Details

#nowObject



36
37
38
# File 'lib/observed/observed_task_factory.rb', line 36

def now
  @time
end

#report(tag, time, data = nil) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/observed/observed_task_factory.rb', line 14

def report(tag, time, data=nil)
  options = nil
  if tag.is_a?(::Hash)
    data = tag
    options = time || {}
    tag = nil
  elsif tag.is_a?(String) && time.is_a?(::Hash)
    options = data
    data = time
  else
    options = {tag: tag, time: time}
  end
  options ||= {}
  options[:tag] ||= tag
  options[:time] ||= now
  @reported = [data, options]
end

#reportedObject



32
33
34
# File 'lib/observed/observed_task_factory.rb', line 32

def reported
  @reported
end