Class: Interfacets::Test::Js::Receivers::Url
- Inherits:
-
Object
- Object
- Interfacets::Test::Js::Receivers::Url
- Defined in:
- lib/interfacets/test/js/receivers/url.rb
Defined Under Namespace
Classes: Handler
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#response_queue ⇒ Object
readonly
Returns the value of attribute response_queue.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
Instance Method Summary collapse
- #flush_responses ⇒ Object
- #handler ⇒ Object
-
#initialize(name:) ⇒ Url
constructor
A new instance of Url.
- #receive(payload:, dispatch:) ⇒ Object
Constructor Details
#initialize(name:) ⇒ Url
Returns a new instance of Url.
33 34 35 36 |
# File 'lib/interfacets/test/js/receivers/url.rb', line 33 def initialize(name:) @name = name @response_queue = [] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
32 33 34 |
# File 'lib/interfacets/test/js/receivers/url.rb', line 32 def name @name end |
#response_queue ⇒ Object (readonly)
Returns the value of attribute response_queue.
32 33 34 |
# File 'lib/interfacets/test/js/receivers/url.rb', line 32 def response_queue @response_queue end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
32 33 34 |
# File 'lib/interfacets/test/js/receivers/url.rb', line 32 def server @server end |
Instance Method Details
#flush_responses ⇒ Object
53 54 55 |
# File 'lib/interfacets/test/js/receivers/url.rb', line 53 def flush_responses response_queue.tap { @response_queue = [] } end |
#handler ⇒ Object
49 50 51 |
# File 'lib/interfacets/test/js/receivers/url.rb', line 49 def handler @handler end |
#receive(payload:, dispatch:) ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/interfacets/test/js/receivers/url.rb', line 38 def receive(payload:, dispatch:) @dispatch = dispatch return if payload.nil? return if payload.empty? return if payload.dig("streams", "default").nil? return if payload.dig("streams", "default").empty? @handler = Handler.new(payload.dig("streams", "default")) end |