iruby 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -113,7 +113,7 @@
113
113
  ],
114
114
  "metadata": {
115
115
  "kernelspec": {
116
- "display_name": "Ruby",
116
+ "display_name": "Ruby 2.1.2",
117
117
  "language": "ruby",
118
118
  "name": "ruby"
119
119
  },
@@ -0,0 +1,171 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {
7
+ "collapsed": false
8
+ },
9
+ "outputs": [
10
+ {
11
+ "data": {
12
+ "text/plain": [
13
+ ":out1"
14
+ ]
15
+ },
16
+ "execution_count": 1,
17
+ "metadata": {},
18
+ "output_type": "execute_result"
19
+ }
20
+ ],
21
+ "source": [
22
+ ":out1"
23
+ ]
24
+ },
25
+ {
26
+ "cell_type": "code",
27
+ "execution_count": 2,
28
+ "metadata": {
29
+ "collapsed": false
30
+ },
31
+ "outputs": [
32
+ {
33
+ "data": {
34
+ "text/plain": [
35
+ ":out2"
36
+ ]
37
+ },
38
+ "execution_count": 2,
39
+ "metadata": {},
40
+ "output_type": "execute_result"
41
+ }
42
+ ],
43
+ "source": [
44
+ ":out2"
45
+ ]
46
+ },
47
+ {
48
+ "cell_type": "code",
49
+ "execution_count": 3,
50
+ "metadata": {
51
+ "collapsed": false
52
+ },
53
+ "outputs": [
54
+ {
55
+ "data": {
56
+ "text/plain": [
57
+ ":out3"
58
+ ]
59
+ },
60
+ "execution_count": 3,
61
+ "metadata": {},
62
+ "output_type": "execute_result"
63
+ }
64
+ ],
65
+ "source": [
66
+ ":out3"
67
+ ]
68
+ },
69
+ {
70
+ "cell_type": "code",
71
+ "execution_count": 4,
72
+ "metadata": {
73
+ "collapsed": false
74
+ },
75
+ "outputs": [
76
+ {
77
+ "name": "stdout",
78
+ "output_type": "stream",
79
+ "text": [
80
+ ":out1\n",
81
+ ":out2\n",
82
+ ":out3\n",
83
+ ":out1\n",
84
+ ":out2\n",
85
+ ":out3\n",
86
+ ":out1\n",
87
+ ":out2\n",
88
+ ":out3\n",
89
+ ":out1\n",
90
+ ":out2\n",
91
+ ":out3\n",
92
+ ":out1\n",
93
+ ":out2\n",
94
+ ":out3\n",
95
+ "out1\n",
96
+ "out2\n",
97
+ "out3\n",
98
+ "out1\n",
99
+ "out2\n",
100
+ "out3\n",
101
+ "out1\n",
102
+ "out2\n",
103
+ "out3\n",
104
+ "out1\n",
105
+ "out2\n",
106
+ "out3\n",
107
+ "out1\n",
108
+ "out2\n",
109
+ "out3\n"
110
+ ]
111
+ }
112
+ ],
113
+ "source": [
114
+ "puts _iii\n",
115
+ "puts _ii\n",
116
+ "puts _i\n",
117
+ "\n",
118
+ "puts _i1\n",
119
+ "puts _i2\n",
120
+ "puts _i3\n",
121
+ "\n",
122
+ "puts _ih[1]\n",
123
+ "puts _ih[2]\n",
124
+ "puts _ih[3]\n",
125
+ "\n",
126
+ "puts In[1]\n",
127
+ "puts In[2]\n",
128
+ "puts In[3]\n",
129
+ "\n",
130
+ "puts In[-3]\n",
131
+ "puts In[-2]\n",
132
+ "puts In[-1]\n",
133
+ "\n",
134
+ "puts ___\n",
135
+ "puts __\n",
136
+ "puts _\n",
137
+ "\n",
138
+ "puts _1\n",
139
+ "puts _2\n",
140
+ "puts _3\n",
141
+ "\n",
142
+ "puts _oh[1]\n",
143
+ "puts _oh[2]\n",
144
+ "puts _oh[3]\n",
145
+ "\n",
146
+ "puts Out[1]\n",
147
+ "puts Out[2]\n",
148
+ "puts Out[3]\n",
149
+ "\n",
150
+ "puts Out[-3]\n",
151
+ "puts Out[-2]\n",
152
+ "puts Out[-1]"
153
+ ]
154
+ }
155
+ ],
156
+ "metadata": {
157
+ "kernelspec": {
158
+ "display_name": "Ruby 2.1.2",
159
+ "language": "ruby",
160
+ "name": "ruby"
161
+ },
162
+ "language_info": {
163
+ "file_extension": "rb",
164
+ "mimetype": "text/ruby",
165
+ "name": "ruby",
166
+ "version": "2.1.2"
167
+ }
168
+ },
169
+ "nbformat": 4,
170
+ "nbformat_minor": 0
171
+ }
@@ -86,7 +86,7 @@
86
86
  ],
87
87
  "metadata": {
88
88
  "kernelspec": {
89
- "display_name": "Ruby",
89
+ "display_name": "Ruby 2.1.2",
90
90
  "language": "ruby",
91
91
  "name": "ruby"
92
92
  },
data/examples/table.ipynb CHANGED
@@ -306,11 +306,50 @@
306
306
  "source": [
307
307
  "IRuby.display IRuby.table({a:1,b:2,c:[3,4]})"
308
308
  ]
309
+ },
310
+ {
311
+ "cell_type": "code",
312
+ "execution_count": 6,
313
+ "metadata": {
314
+ "collapsed": false
315
+ },
316
+ "outputs": [
317
+ {
318
+ "data": {
319
+ "text/html": [
320
+ "<table><tr><th><span style='color:red'>a</span></th><th>b</th><th>c</th></tr><tr><td>1</td><td>2</td><td>3</td></tr><tr><td></td><td></td><td><span style='color:red'>4</span></td></tr></table>"
321
+ ],
322
+ "text/plain": [
323
+ "\"<table><tr><th><span style='color:red'>a</span></th><th>b</th><th>c</th></tr><tr><td>1</td><td>2</td><td>3</td></tr><tr><td></td><td></td><td><span style='color:red'>4</span></td></tr></table>\""
324
+ ]
325
+ },
326
+ "metadata": {},
327
+ "output_type": "display_data"
328
+ }
329
+ ],
330
+ "source": [
331
+ "class Red < String\n",
332
+ " def to_html\n",
333
+ " \"<span style='color:red'>#{self}</span>\"\n",
334
+ " end\n",
335
+ "end\n",
336
+ "\n",
337
+ "IRuby.display IRuby.table({Red.new(\"a\") => 1, b:2, c: [3, Red.new(\"4\")]})"
338
+ ]
339
+ },
340
+ {
341
+ "cell_type": "code",
342
+ "execution_count": null,
343
+ "metadata": {
344
+ "collapsed": true
345
+ },
346
+ "outputs": [],
347
+ "source": []
309
348
  }
310
349
  ],
311
350
  "metadata": {
312
351
  "kernelspec": {
313
- "display_name": "Ruby",
352
+ "display_name": "Ruby 2.1.2",
314
353
  "language": "ruby",
315
354
  "name": "ruby"
316
355
  },
data/lib/iruby/backend.rb CHANGED
@@ -1,10 +1,45 @@
1
1
  module IRuby
2
+ In, Out = [nil], [nil]
3
+ ::In, ::Out = In, Out
4
+
5
+ module HistoryVariables
6
+ def eval(code, store_history)
7
+ b = TOPLEVEL_BINDING
8
+
9
+ b.local_variable_set(:_ih, In) unless b.local_variable_defined?(:_ih)
10
+ b.local_variable_set(:_oh, Out) unless b.local_variable_defined?(:_oh)
11
+
12
+ out = super
13
+
14
+ # TODO Add IRuby.cache_size which controls the size of the Out array
15
+ # and sets the oldest entries and _<n> variables to nil.
16
+ if store_history
17
+ b.local_variable_set("_#{Out.size}", out)
18
+ b.local_variable_set("_i#{In.size}", code)
19
+
20
+ Out << out
21
+ In << code
22
+
23
+ b.local_variable_set(:___, Out[-3])
24
+ b.local_variable_set(:__, Out[-2])
25
+ b.local_variable_set(:_, Out[-1])
26
+ b.local_variable_set(:_iii, In[-3])
27
+ b.local_variable_set(:_ii, In[-2])
28
+ b.local_variable_set(:_i, In[-1])
29
+ end
30
+
31
+ out
32
+ end
33
+ end
34
+
2
35
  class PlainBackend
36
+ prepend HistoryVariables
37
+
3
38
  def initialize
4
39
  Bond.start(debug: true)
5
40
  end
6
41
 
7
- def eval(code)
42
+ def eval(code, store_history)
8
43
  TOPLEVEL_BINDING.eval(code)
9
44
  end
10
45
 
@@ -14,6 +49,8 @@ module IRuby
14
49
  end
15
50
 
16
51
  class PryBackend
52
+ prepend HistoryVariables
53
+
17
54
  def initialize
18
55
  require 'pry'
19
56
  Pry.pager = false # Don't use the pager
@@ -23,11 +60,10 @@ module IRuby
23
60
  raise 'Falling back to plain backend since your version of Pry is too old (the Pry instance doesn\'t support #eval). You may need to install the pry gem with --pre enabled.' unless @pry.respond_to?(:eval)
24
61
  end
25
62
 
26
- def eval(code)
27
- @pry.last_result = nil
63
+ def eval(code, store_history)
28
64
  raise SystemExit unless @pry.eval(code)
29
65
  raise @pry.last_exception if @pry.last_result_is_exception?
30
- @pry.push_initial_binding unless @pry.current_binding
66
+ @pry.push_initial_binding unless @pry.current_binding # ensure that we have a binding
31
67
  @pry.last_result
32
68
  end
33
69
 
data/lib/iruby/comm.rb CHANGED
@@ -5,9 +5,8 @@ module IRuby
5
5
  attr_writer :on_msg, :on_close
6
6
 
7
7
  class << self
8
- def targets
9
- @targets ||= {}
10
- end
8
+ def target; @target ||= {} end
9
+ def comm; @comm ||= {} end
11
10
  end
12
11
 
13
12
  def initialize(target_name, comm_id = SecureRandom.uuid)
@@ -15,30 +14,17 @@ module IRuby
15
14
  end
16
15
 
17
16
  def open(**data)
18
- content = {
19
- comm_id: @comm_id,
20
- data: data,
21
- target_name: @target_name
22
- }
23
- Kernel.instance.session.send(:publish, 'comm_open', content)
24
- Kernel.instance.comms[@comm_id] = self
17
+ Kernel.instance.session.send(:publish, :comm_open, comm_id: @comm_id, data: data, target_name: @target_name)
18
+ Comm.comm[@comm_id] = self
25
19
  end
26
20
 
27
21
  def send(**data)
28
- content = {
29
- comm_id: @comm_id,
30
- data: data
31
- }
32
- Kernel.instance.session.send(:publish, 'comm_msg', content)
22
+ Kernel.instance.session.send(:publish, :comm_msg, comm_id: @comm_id, data: data)
33
23
  end
34
24
 
35
25
  def close(**data)
36
- content = {
37
- comm_id: @comm_id,
38
- data: data
39
- }
40
- Kernel.instance.session.send(:publish, 'comm_close', content)
41
- Kernel.instance.comms.delete(@comm_id)
26
+ Kernel.instance.session.send(:publish, :comm_close, comm_id: @comm_id, data: data)
27
+ Comm.comm.delete(@comm_id)
42
28
  end
43
29
 
44
30
  def on_msg(&b)
@@ -49,12 +35,12 @@ module IRuby
49
35
  @on_close = b
50
36
  end
51
37
 
52
- def comm_msg(msg)
53
- @on_msg.call(msg) if @on_msg
38
+ def handle_msg(data)
39
+ @on_msg.call(data) if @on_msg
54
40
  end
55
41
 
56
- def comm_close
57
- @on_close.call if @on_close
42
+ def handle_close(data)
43
+ @on_close.call(data) if @on_close
58
44
  end
59
45
  end
60
46
  end
data/lib/iruby/command.rb CHANGED
@@ -18,7 +18,7 @@ module IRuby
18
18
  case @args.first
19
19
  when 'version', '-v', '--version'
20
20
  require 'iruby/version'
21
- puts IRuby::VERSION
21
+ puts "IRuby #{IRuby::VERSION}, Ruby #{RUBY_VERSION}"
22
22
  when 'help', '-h', '--help'
23
23
  print_help
24
24
  when 'register'
@@ -103,7 +103,7 @@ Try `ipython help` for more information.
103
103
  FileUtils.mkpath(@kernel_dir)
104
104
  File.write(@kernel_file, %{{
105
105
  "argv": [ "#{File.expand_path $0}", "kernel", "{connection_file}" ],
106
- "display_name": "Ruby",
106
+ "display_name": "Ruby #{RUBY_VERSION}",
107
107
  "language": "ruby"
108
108
  }
109
109
  })
@@ -92,8 +92,8 @@ module IRuby
92
92
  table = '<table>'
93
93
 
94
94
  if header1 && options[:header] != false
95
- table << '<tr>' << header1.map {|k| "<th>#{k}</th>" }.join
96
- table << "<th>&#8230;</th>" << header2.map {|k| "<th>#{k}</th>" }.join if keys2
95
+ table << '<tr>' << header1.map {|k| "<th>#{cell k}</th>" }.join
96
+ table << "<th>&#8230;</th>" << header2.map {|k| "<th>#{cell k}</th>" }.join if keys2
97
97
  table << '</tr>'
98
98
  end
99
99
 
@@ -112,16 +112,24 @@ module IRuby
112
112
 
113
113
  private
114
114
 
115
+ def cell(obj)
116
+ obj.respond_to?(:to_html) ? obj.to_html : obj
117
+ end
118
+
119
+ def elem(row, k)
120
+ cell((row[k] rescue nil))
121
+ end
122
+
115
123
  def row_block(table, rows, keys1, keys2)
116
124
  cols = keys1.size
117
125
  cols += keys2.size + 1 if keys2
118
126
  rows.each_with_index do |row, i|
119
127
  table << '<tr>'
120
128
  if row.respond_to?(:map)
121
- row_html = keys1.map {|k| "<td>#{row[k] rescue nil}</td>" }.join
129
+ row_html = keys1.map {|k| "<td>#{elem row, k}</td>" }.join
122
130
  if keys2
123
131
  row_html << "<td#{rows.size > 1 ? " rowspan='#{rows.size}'" : ''}>&#8230;</td>" if i == 0
124
- row_html << keys2.map {|k| "<td>#{row[k] rescue nil}</td>" }.join
132
+ row_html << keys2.map {|k| "<td>#{elem row, k}</td>" }.join
125
133
  end
126
134
  if row_html.empty?
127
135
  table << "<td#{cols > 1 ? " colspan='#{cols}'" : ''}></td>"
@@ -129,7 +137,7 @@ module IRuby
129
137
  table << row_html
130
138
  end
131
139
  else
132
- table << "<td#{cols > 1 ? " colspan='#{cols}'" : ''}>#{row}</td>"
140
+ table << "<td#{cols > 1 ? " colspan='#{cols}'" : ''}>#{cell row}</td>"
133
141
  end
134
142
  table << '</tr>'
135
143
  end
data/lib/iruby/kernel.rb CHANGED
@@ -8,43 +8,20 @@ module IRuby
8
8
  attr_accessor :instance
9
9
  end
10
10
 
11
- attr_reader :session, :comms
11
+ attr_reader :session
12
12
 
13
13
  def initialize(config_file)
14
14
  @config = MultiJson.load(File.read(config_file))
15
-
16
15
  IRuby.logger.debug("IRuby kernel start with config #{@config}")
17
-
18
16
  Kernel.instance = self
19
17
 
20
- c = ZMQ::Context.new
21
-
22
- connection = "#{@config['transport']}://#{@config['ip']}:%d"
23
- reply_socket = c.socket(:ROUTER)
24
- reply_socket.bind(connection % @config['shell_port'])
25
-
26
- pub_socket = c.socket(:PUB)
27
- pub_socket.bind(connection % @config['iopub_port'])
28
-
29
- Thread.new do
30
- begin
31
- hb_socket = c.socket(:REP)
32
- hb_socket.bind(connection % @config['hb_port'])
33
- ZMQ.proxy(hb_socket, hb_socket)
34
- rescue Exception => ex
35
- IRuby.logger.fatal "Kernel heartbeat died: #{ex.message}\n"#{ex.backtrace.join("\n")}"
36
- end
37
- end
38
-
39
- @session = Session.new('kernel', @config, publish: pub_socket, reply: reply_socket)
40
-
41
- $stdout = OStream.new(@session, 'stdout')
42
- $stderr = OStream.new(@session, 'stderr')
18
+ @session = Session.new(@config)
19
+ $stdout = OStream.new(@session, :stdout)
20
+ $stderr = OStream.new(@session, :stderr)
43
21
 
44
22
  @execution_count = 0
45
23
  @backend = create_backend
46
24
  @running = true
47
- @comms = {}
48
25
  end
49
26
 
50
27
  def create_backend
@@ -55,55 +32,48 @@ module IRuby
55
32
  end
56
33
 
57
34
  def run
58
- send_status('starting')
35
+ send_status :starting
59
36
  while @running
60
- ident, msg = @session.recv(:reply)
37
+ msg = @session.recv(:reply)
61
38
  type = msg[:header]['msg_type']
62
39
  if type =~ /comm_|_request\Z/ && respond_to?(type)
63
- send_status('busy')
64
- send(type, ident, msg)
65
- send_status('idle')
40
+ send_status :busy
41
+ send(type, msg)
42
+ send_status :idle
66
43
  else
67
44
  IRuby.logger.error "Unknown message type: #{msg[:header]['msg_type']} #{msg.inspect}"
68
45
  end
69
46
  end
70
47
  end
71
48
 
72
- def kernel_info_request(ident, msg)
73
- content = {
74
- protocol_version: '5.0',
75
- implementation: 'iruby',
76
- implementation_version: IRuby::VERSION,
77
- language_info: {
78
- name: 'ruby',
79
- version: RUBY_VERSION,
80
- mimetype: 'text/ruby',
81
- file_extension: 'rb',
82
- },
83
- banner: "IRuby #{IRuby::VERSION}"
84
- }
85
- @session.send(:reply, 'kernel_info_reply', content, ident)
49
+ def kernel_info_request(msg)
50
+ @session.send(:reply, :kernel_info_reply,
51
+ protocol_version: '5.0',
52
+ implementation: 'iruby',
53
+ banner: "IRuby #{IRuby::VERSION}",
54
+ implementation_version: IRuby::VERSION,
55
+ language_info: {
56
+ name: 'ruby',
57
+ version: RUBY_VERSION,
58
+ mimetype: 'text/ruby',
59
+ file_extension: 'rb'
60
+ })
86
61
  end
87
62
 
88
63
  def send_status(status)
89
- @session.send(:publish, 'status', {execution_state: status})
64
+ @session.send(:publish, :status, execution_state: status)
90
65
  end
91
66
 
92
- def execute_request(ident, msg)
93
- begin
94
- code = msg[:content]['code']
95
- rescue
96
- IRuby.logger.fatal "Got bad message: #{msg.inspect}"
97
- return
98
- end
99
- @execution_count += 1 unless msg[:content].fetch('silent', false)
100
- @session.send(:publish, 'execute_input', {code: code, execution_count: @execution_count}, ident)
67
+ def execute_request(msg)
68
+ code = msg[:content]['code']
69
+ @execution_count += 1 if msg[:content]['store_history']
70
+ @session.send(:publish, :execute_input, code: code, execution_count: @execution_count)
101
71
 
102
72
  result = nil
103
73
  begin
104
- result = @backend.eval(code)
74
+ result = @backend.eval(code, msg[:content]['store_history'])
105
75
  content = {
106
- status: 'ok',
76
+ status: :ok,
107
77
  payload: [],
108
78
  user_expressions: {},
109
79
  execution_count: @execution_count
@@ -112,90 +82,67 @@ module IRuby
112
82
  raise
113
83
  rescue Exception => e
114
84
  content = {
115
- status: 'error',
85
+ status: :error,
116
86
  ename: e.class.to_s,
117
87
  evalue: e.message,
118
88
  traceback: ["#{RED}#{e.class}#{RESET}: #{e.message}", *e.backtrace.map { |l| "#{WHITE}#{l}#{RESET}" }],
119
89
  execution_count: @execution_count
120
90
  }
121
- @session.send(:publish, 'error', content, ident)
91
+ @session.send(:publish, :error, content)
122
92
  end
123
- @session.send(:reply, 'execute_reply', content, ident)
93
+ @session.send(:reply, :execute_reply, content)
124
94
  unless result.nil? || msg[:content]['silent']
125
- @session.send(:publish, 'execute_result', data: Display.display(result), metadata: {}, execution_count: @execution_count)
95
+ @session.send(:publish, :execute_result, data: Display.display(result), metadata: {}, execution_count: @execution_count)
126
96
  end
127
97
  end
128
98
 
129
- def complete_request(ident, msg)
130
- content = {
131
- matches: @backend.complete(msg[:content]['code']),
132
- status: 'ok',
133
- cursor_start: 0,
134
- cursor_end: msg[:content]['cursor_pos']
135
- }
136
- @session.send(:reply, 'complete_reply', content, ident)
99
+ def complete_request(msg)
100
+ @session.send(:reply, :complete_reply,
101
+ matches: @backend.complete(msg[:content]['code']),
102
+ status: :ok,
103
+ cursor_start: 0,
104
+ cursor_end: msg[:content]['cursor_pos'])
137
105
  end
138
106
 
139
- def connect_request(ident, msg)
140
- content = {
141
- shell_port: config['shell_port'],
142
- iopub_port: config['iopub_port'],
143
- stdin_port: config['stdin_port'],
144
- hb_port: config['hb_port']
145
- }
146
- @session.send(:reply, 'connect_reply', content, ident)
107
+ def connect_request(msg)
108
+ @session.send(:reply, :connect_reply, Hash[%w(shell_port iopub_port stdin_port hb_port).map {|k| [k, @config[k]] }])
147
109
  end
148
110
 
149
- def shutdown_request(ident, msg)
150
- @session.send(:reply, 'shutdown_reply', msg[:content], ident)
111
+ def shutdown_request(msg)
112
+ @session.send(:reply, :shutdown_reply, msg[:content])
151
113
  @running = false
152
114
  end
153
115
 
154
- def history_request(ident, msg)
116
+ def history_request(msg)
155
117
  # we will just send back empty history for now, pending clarification
156
118
  # as requested in ipython/ipython#3806
157
- content = {
158
- history: []
159
- }
160
- @session.send(:reply, 'history_reply', content, ident)
119
+ @session.send(:reply, :history_reply, history: [])
161
120
  end
162
121
 
163
- def inspect_request(ident, msg)
164
- o = @backend.eval(msg[:content]['oname'])
165
- content = {
166
- oname: msg[:content]['oname'],
167
- found: true,
168
- ismagic: false,
169
- isalias: false,
170
- docstring: '', # TODO
171
- type_class: o.class.superclass.to_s,
172
- string_form: o.inspect
173
- }
174
- content[:length] = o.length if o.respond_to?(:length)
175
- @session.send(:reply, 'inspect_reply', content, ident)
122
+ def inspect_request(msg)
123
+ result = @backend.eval(msg[:content]['code'])
124
+ @session.send(:reply, :inspect_reply,
125
+ status: :ok,
126
+ data: Display.display(result),
127
+ metadata: {})
176
128
  rescue Exception
177
- content = {
178
- oname: msg[:content]['oname'],
179
- found: false
180
- }
181
- @session.send(:reply, 'inspect_reply', content, ident)
129
+ @session.send(:reply, :inspect_reply, status: 'error')
182
130
  end
183
131
 
184
- def comm_open(ident, msg)
132
+ def comm_open(msg)
185
133
  comm_id = msg[:content]['comm_id']
186
134
  target_name = msg[:content]['target_name']
187
- target = Comm.targets[target_name]
188
- @comms[comm_id] = target.new(target_name, comm_id)
135
+ Comm.comm[comm_id] = Comm.target[target_name].new(target_name, comm_id)
189
136
  end
190
137
 
191
- def comm_msg(ident, msg)
192
- @comms[msg[:content]['comm_id']].comm_msg(msg[:content]['data'])
138
+ def comm_msg(msg)
139
+ Comm.comm[msg[:content]['comm_id']].handle_msg(msg[:content]['data'])
193
140
  end
194
141
 
195
- def comm_close(ident, msg)
142
+ def comm_close(msg)
196
143
  comm_id = msg[:content]['comm_id']
197
- @comms[comm_id].comm_close
198
- @comms.delete(comm_id)
144
+ Comm.comm[comm_id].handle_close(msg[:content]['data'])
145
+ Comm.comm.delete(comm_id)
199
146
  end
200
147
  end
201
148
  end