Class: RubyHome::HTTP::SessionNotifier

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session, characteristic) ⇒ SessionNotifier

Returns a new instance of SessionNotifier.



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

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

Instance Attribute Details

#characteristicObject (readonly)

Returns the value of attribute characteristic.



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

def characteristic
  @characteristic
end

#sessionObject (readonly)

Returns the value of attribute session.



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

def session
  @session
end

Instance Method Details

#==(other) ⇒ Object



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

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

#after_update(_) ⇒ Object



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

def after_update(_)
  if session.active?
    send_ev_response
  else
    characteristic.unsubscribe(self)
  end
end