Class: Riddl::SSEImplementation
- Inherits:
-
Object
- Object
- Riddl::SSEImplementation
- Defined in:
- lib/ruby/riddl/implementation.rb
Instance Method Summary collapse
- #close ⇒ Object
- #closed? ⇒ Boolean
-
#initialize(ws) ⇒ SSEImplementation
constructor
A new instance of SSEImplementation.
- #io ⇒ Object
- #io=(connection) ⇒ Object
- #onclose ⇒ Object
- #onerror(err) ⇒ Object
- #onopen ⇒ Object
- #send(data) ⇒ Object
- #send_with_id(id, data) ⇒ Object
Constructor Details
#initialize(ws) ⇒ SSEImplementation
Returns a new instance of SSEImplementation.
29 30 31 32 33 34 35 36 |
# File 'lib/ruby/riddl/implementation.rb', line 29 def initialize(ws) @ws = ws @r = ws[:r] # the matching resource path @s = ws[:s] # the matching resource path schema @match = ws[:match] # the path of the branch matching, important for recursive @env = ws[:env] # environment (all headers) @a = ws[:a] # args to run command end |
Instance Method Details
#close ⇒ Object
59 60 61 |
# File 'lib/ruby/riddl/implementation.rb', line 59 def close @ws[:io].close end |
#closed? ⇒ Boolean
55 56 57 |
# File 'lib/ruby/riddl/implementation.rb', line 55 def closed? @ws[:io].closed? end |
#io ⇒ Object
52 53 54 |
# File 'lib/ruby/riddl/implementation.rb', line 52 def io @ws[:io] end |
#io=(connection) ⇒ Object
49 50 51 |
# File 'lib/ruby/riddl/implementation.rb', line 49 def io=(connection) @ws[:io] = connection end |
#onclose ⇒ Object
39 |
# File 'lib/ruby/riddl/implementation.rb', line 39 def onclose;end |
#onerror(err) ⇒ Object
40 |
# File 'lib/ruby/riddl/implementation.rb', line 40 def onerror(err);end |
#onopen ⇒ Object
38 |
# File 'lib/ruby/riddl/implementation.rb', line 38 def onopen;end |
#send(data) ⇒ Object
42 43 44 |
# File 'lib/ruby/riddl/implementation.rb', line 42 def send(data) @ws[:io].send_with_id 'data', data end |
#send_with_id(id, data) ⇒ Object
45 46 47 |
# File 'lib/ruby/riddl/implementation.rb', line 45 def send_with_id(id,data) @ws[:io].send_with_id id, data end |