Class: MixinBot::Monitor::AppMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/mixin_bot/monitor.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project: nil, status: 0, data: []) ⇒ AppMessage

Returns a new instance of AppMessage.



11
12
13
14
15
# File 'lib/mixin_bot/monitor.rb', line 11

def initialize(project: nil, status: 0, data: [])
  @project = project
  @status = status
  @data = data
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



9
10
11
# File 'lib/mixin_bot/monitor.rb', line 9

def data
  @data
end

#projectObject

Returns the value of attribute project.



9
10
11
# File 'lib/mixin_bot/monitor.rb', line 9

def project
  @project
end

#statusObject

Returns the value of attribute status.



9
10
11
# File 'lib/mixin_bot/monitor.rb', line 9

def status
  @status
end

Class Method Details

.load(yaml_str) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/mixin_bot/monitor.rb', line 17

def self.load(yaml_str)
  h = YAML.safe_load(yaml_str, permitted_classes: [Symbol], aliases: true)
  new(
    project: h['project'],
    status: h['status'] || 0,
    data: Array(h['data'])
  )
end

Instance Method Details

#marshalObject



26
27
28
29
30
31
32
# File 'lib/mixin_bot/monitor.rb', line 26

def marshal
  YAML.dump(
    'project' => project,
    'status' => status,
    'data' => data
  )
end