Class: Interfacets::Test::Js::Receivers::Timer::Registration

Inherits:
Object
  • Object
show all
Defined in:
lib/interfacets/test/js/receivers/timer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ms:, response_payload:, dispatch:) ⇒ Registration

Returns a new instance of Registration.



13
14
15
16
17
18
# File 'lib/interfacets/test/js/receivers/timer.rb', line 13

def initialize(ms:, response_payload:, dispatch:)
  @ms = ms
  @response_payload = response_payload
  @dispatch = dispatch
  @notified = false
end

Instance Attribute Details

#dispatch ⇒ Object (readonly)

Returns the value of attribute dispatch.



11
12
13
# File 'lib/interfacets/test/js/receivers/timer.rb', line 11

def dispatch
  @dispatch
end

#ms ⇒ Object (readonly)

Returns the value of attribute ms.



11
12
13
# File 'lib/interfacets/test/js/receivers/timer.rb', line 11

def ms
  @ms
end

#response_payload ⇒ Object (readonly)

Returns the value of attribute response_payload.



11
12
13
# File 'lib/interfacets/test/js/receivers/timer.rb', line 11

def response_payload
  @response_payload
end

Instance Method Details

#notify ⇒ Object



20
21
22
23
24
# File 'lib/interfacets/test/js/receivers/timer.rb', line 20

def notify
  return if @notified
  @dispatch.call({ payload: response_payload })
  @notified = true
end