Class: Riddl::SSEImplementation

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby/riddl/implementation.rb

Instance Method Summary collapse

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

#closeObject



59
60
61
# File 'lib/ruby/riddl/implementation.rb', line 59

def close
  @ws[:io].close
end

#closed?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/ruby/riddl/implementation.rb', line 55

def closed?
  @ws[:io].closed?
end

#ioObject



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

#oncloseObject



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

#onopenObject



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