class Sapristi::Monitor

Constants

ATTRIBUTES

Public Class Methods

new(data) click to toggle source
# File lib/sapristi/monitor.rb, line 5
def initialize(data)
  data.each { |key, value| instance_variable_set "@#{key}".to_sym, value }
end

Public Instance Methods

==(other) click to toggle source
# File lib/sapristi/monitor.rb, line 27
def ==(other)
  other.class == self.class && state == other.state
end
Also aliased as: eql?
[](key) click to toggle source
# File lib/sapristi/monitor.rb, line 9
def [](key)
  instance_variable_get "@#{key}"
end
eql?(other)
Alias for: ==
hash() click to toggle source
# File lib/sapristi/monitor.rb, line 23
def hash
  state.hash
end
to_s() click to toggle source
# File lib/sapristi/monitor.rb, line 15
def to_s
  # rubocop:disable Layout/LineLength
  "#{id} #{main ? 'main' : '    '} #{name} #{x}x#{y} workarea[x=#{work_area[0]}, y=#{work_area[1]}, width=#{work_area_width}, height=#{work_area_height}]"
  # rubocop:enable Layout/LineLength
end

Protected Instance Methods

state() click to toggle source
# File lib/sapristi/monitor.rb, line 35
def state
  ATTRIBUTES.map { |attribute| send attribute }
end