Class: Sapristi::Monitor

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

Constant Summary collapse

ATTRIBUTES =
%i[id main name x y offset_x offset_y work_area work_area_width work_area_height].freeze

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Monitor

Returns a new instance of Monitor.



5
6
7
# File 'lib/sapristi/monitor.rb', line 5

def initialize(data)
  data.each { |key, value| instance_variable_set "@#{key}".to_sym, value }
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



21
22
23
# File 'lib/sapristi/monitor.rb', line 21

def ==(other)
  other.class == self.class && state == other.state
end

#[](key) ⇒ Object



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

def [](key)
  instance_variable_get "@#{key}"
end

#hashObject



17
18
19
# File 'lib/sapristi/monitor.rb', line 17

def hash
  state.hash
end