Class: Fusuma::Plugin::Events::Event

Inherits:
Base
  • Object
show all
Defined in:
lib/fusuma/plugin/events/event.rb

Overview

Event format

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#config_index, #config_param_types, #config_params, inherited, plugins, #shutdown

Constructor Details

#initialize(tag:, record:, time: Time.now) ⇒ Event

Returns a new instance of Event.

Parameters:

  • time (Time) (defaults to: Time.now)
  • tag (Tag)
  • record (String, Record)


18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/fusuma/plugin/events/event.rb', line 18

def initialize(tag:, record:, time: Time.now)
  super()
  @time = time
  @tag = tag
  @record = case record
  when Records::Record
    record
  when String
    Records::TextRecord.new(record)
  else
    raise ArgumentError,
      "@record should be String or Record: #{record.class}, #{record}"
  end
end

Instance Attribute Details

#recordObject

Returns the value of attribute record.



13
14
15
# File 'lib/fusuma/plugin/events/event.rb', line 13

def record
  @record
end

#tagObject

Returns the value of attribute tag.



13
14
15
# File 'lib/fusuma/plugin/events/event.rb', line 13

def tag
  @tag
end

#timeObject (readonly)

Returns the value of attribute time.



12
13
14
# File 'lib/fusuma/plugin/events/event.rb', line 12

def time
  @time
end

Instance Method Details

#inspectObject



33
34
35
# File 'lib/fusuma/plugin/events/event.rb', line 33

def inspect
  "tag: #{tag}, record: #{record}"
end