Class: RubyHome::HTTP::SocketNotifier

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_home/http/services/socket_notifier.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(socket, characteristic) ⇒ SocketNotifier

Returns a new instance of SocketNotifier.



4
5
6
7
# File 'lib/ruby_home/http/services/socket_notifier.rb', line 4

def initialize(socket, characteristic)
  @socket = socket
  @characteristic = characteristic
end

Instance Attribute Details

#characteristicObject (readonly)

Returns the value of attribute characteristic.



23
24
25
# File 'lib/ruby_home/http/services/socket_notifier.rb', line 23

def characteristic
  @characteristic
end

#socketObject (readonly)

Returns the value of attribute socket.



23
24
25
# File 'lib/ruby_home/http/services/socket_notifier.rb', line 23

def socket
  @socket
end

Instance Method Details

#==(other) ⇒ Object



17
18
19
20
21
# File 'lib/ruby_home/http/services/socket_notifier.rb', line 17

def ==(other)
  self.class == other.class &&
    self.socket == other.socket &&
    self.characteristic == other.characteristic
end

#updated(_) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/ruby_home/http/services/socket_notifier.rb', line 9

def updated(_)
  if socket_still_active?
    send_ev_response
  else
    characteristic.unsubscribe(self)
  end
end