iruby 0.2.9 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: edce35917d38e538781f2ab3827063693e6c6417
4
- data.tar.gz: 9048d037809e1c69ff223c9363a2e743a5466931
3
+ metadata.gz: 535b2e6920da18e1d6610cda01d192814a5f9595
4
+ data.tar.gz: 401889f3e858262e478fa15a3c709bcd6d09bd16
5
5
  SHA512:
6
- metadata.gz: 319cc7a36eadd9c88ee9aad9cf9a3ae845d32d17efc8c00ec228ae89988b1273ffb2e26e0721ff3337454cd7e7d27ca36d9885fef05b4d9198d14268c5b1785b
7
- data.tar.gz: c0ff35cf5547c57343919a427041ed4fb297f3947f26b795252522bf85d7850f7ad44a23c73807606394a9078a68503f3bbaf36074bade8ced1e4b6da22aae91
6
+ metadata.gz: 5d35b89326c32a1dcb52fc2242e366b693ffcac70b3b0ad232233010a6cd1de7c894429c724fb96a766ed35d995465c7b61e3274c7836639a8afd7a9fa56f0e9
7
+ data.tar.gz: 423d15b33c265bd943b5811fb3993f79d2da741790948f9efdd5890ca0f755f94d9fdb51ee78faf5adfa612a30d031e4014758725322f4fe22fd099c37a093c4
data/CHANGES CHANGED
@@ -1,3 +1,24 @@
1
+ 0.3 (2017-03-26)
2
+
3
+ Bug Fixes:
4
+ * Disable Jupyter keyboard manager for all popups made using IRuby.popup (@kylekyle).
5
+ * Fix Iruby/Input date values bug that set date fields to whatever the last date value was (@kylekyle).
6
+ * Fix a bug where time strings put into prompter would give an 'out of range' error (@kylekyle).
7
+
8
+ Enhancements:
9
+ * Improvements to IRuby dependency detection using `Bundler::Dependencies#specs` (@kou).
10
+ * Use less memory forcing pry to store only the last 3 commands in memory (@kylekyle).
11
+ * Use bigger z-index that is used accross all browsers (@kylekyle).
12
+ * Ability to input date values as DateTime objects in IRuby/Input (@kylekyle).
13
+ * Add option to have check boxes checked by default (@kylekyle).
14
+ * Option for multi-select in drop down menus in the prompter (@kylekyle).
15
+ * Add support for multiple widgets using `IRuby::Input::Multiple` (@kylekyle).
16
+ * Calender icon for date selector icon (@kylekyle).
17
+ * Add support for Numo/NArray (@zalt50).
18
+ * Text now only completes after a space (@zalt50).
19
+ * Remove the DONTWAIT flag when receiving a message (@cloud-oak).
20
+ * Add support for CZTop (@kou).
21
+
1
22
  0.2.9 (2016-05-02)
2
23
 
3
24
  Bug Fixes:
data/Gemfile CHANGED
@@ -10,6 +10,6 @@ end
10
10
  group :plot do
11
11
  gem 'gnuplot'
12
12
  gem 'rubyvis'
13
- gem 'nyaplot', github: 'domitry/nyaplot'
13
+ gem 'nyaplot', github: 'sciruby/nyaplot'
14
14
  end
15
15
 
data/README.md CHANGED
@@ -12,14 +12,14 @@ The installation instructions are divided according to environments mainly becau
12
12
  #### Ubuntu/Debian
13
13
  At first install IPython/Jupyter. I recommend an installation using virtualenv.
14
14
 
15
- apt-get install python3-dev virtualenv libzmq3-dev
15
+ sudo apt-get install python3-dev python-virtualenv
16
16
  virtualenv -p python3 venv
17
17
  source venv/bin/activate
18
18
  pip install 'ipython[notebook]'
19
19
 
20
20
  After that, install the Ruby gem.
21
21
 
22
- gem install rbczmq
22
+ gem install cztop
23
23
  gem install iruby
24
24
 
25
25
  Now you can run iruby with:
@@ -29,17 +29,9 @@ Now you can run iruby with:
29
29
  #### Windows
30
30
  At first install IPython/Jupyter. I recommend an installation using [Enthought Canopy](https://www.enthought.com/).
31
31
 
32
- Please update your PATH to include build tools or download the DevKit from http://rubyinstaller.org/downloads and follow [this instructions](http://github.com/oneclick/rubyinstaller/wiki/Development-Kit).
33
-
34
- After that install ZeroMQ Legacy Stable Release 3.2.4 [x86 build for Windows XP SP3 and newer](http://miru.hk/archive/ZeroMQ-3.2.4~miru1.0-x86.exe).
35
-
36
- Rename `libzmq-v100-mt-3_2_4.dll` to `libzmq.dll`.
37
-
38
- Add the dll path to the PATH system variable.
39
-
40
32
  Run two commands below:
41
33
 
42
- gem install ffi-rzmq
34
+ gem install cztop
43
35
  gem install iruby
44
36
 
45
37
  Now you can run iruby with:
@@ -52,7 +44,7 @@ I recommend an installation using [Anaconda](https://store.continuum.io/cshop/an
52
44
  After that, run three commands shown below.
53
45
 
54
46
  brew install libtool autoconf automake autogen
55
- gem install rbczmq
47
+ gem install cztop
56
48
  gem install iruby
57
49
 
58
50
  #### FreeBSD
@@ -99,8 +91,7 @@ Since jRuby is fully compatible with Ruby version 2.2, it is possible to use iru
99
91
  It can be helpful if you want to use java classes in your iruby notebook.
100
92
  This will require the following software:
101
93
  * jRuby version >= 9.0.4.0
102
- * ZeroMQ version >= 4.1.4 (You may have to build it from source.)
103
- * ffi-rzmq gem
94
+ * cztop gem
104
95
  * this iruby gem
105
96
 
106
97
  After installation, make sure that your `env` is set up to jruby.
@@ -126,7 +117,9 @@ and other scientific gems. You can find the prebuild image at [dockerhub](https:
126
117
  * IPython/Jupyter >= 3.0.0
127
118
  * Ruby >= 2.1.0
128
119
 
129
- If you install IRuby with ffi-rzmq instead of rbczmq, libzmq >= 3.2 is added to the list above.
120
+ If you install IRuby with CZTop, CZMQ >= 4.0.0 is added to the list above.
121
+
122
+ If you install IRuby with ffi-rzmq, libzmq >= 3.2 is added to the list above.
130
123
 
131
124
  ### Authors
132
125
 
@@ -16,11 +16,15 @@ require 'iruby/comm'
16
16
  require 'iruby/session/mixin'
17
17
 
18
18
  begin
19
- require 'iruby/session/rbczmq'
19
+ require 'iruby/session/cztop'
20
20
  rescue LoadError
21
21
  begin
22
- require 'iruby/session/ffi_rzmq'
22
+ require 'iruby/session/rbczmq'
23
23
  rescue LoadError
24
- STDERR.puts "You should install rbczmq or ffi_rzmq before running iruby notebook. See README."
24
+ begin
25
+ require 'iruby/session/ffi_rzmq'
26
+ rescue LoadError
27
+ STDERR.puts "You should install cztop, rbczmq or ffi_rzmq before running iruby notebook. See README."
28
+ end
25
29
  end
26
30
  end
@@ -54,6 +54,7 @@ module IRuby
54
54
 
55
55
  def initialize
56
56
  require 'pry'
57
+ Pry.memory_size = 3
57
58
  Pry.pager = false # Don't use the pager
58
59
  Pry.print = proc {|output, value|} # No result printing
59
60
  Pry.exception_handler = proc {|output, exception, _| }
@@ -106,7 +106,7 @@ This might not work. Run 'iruby register --force' to fix it." if @iruby_path !=
106
106
  def check_bundler
107
107
  require 'bundler'
108
108
  raise %q{iruby is missing from Gemfile. This might not work.
109
- Add `gem 'iruby'` to your Gemfile to fix it.} unless Bundler.definition.dependencies.any? {|s| s.name == 'iruby' }
109
+ Add `gem 'iruby'` to your Gemfile to fix it.} unless Bundler.definition.specs.any? {|s| s.name == 'iruby' }
110
110
  Bundler.setup
111
111
  rescue LoadError
112
112
  rescue Exception => e
@@ -169,6 +169,16 @@ module IRuby
169
169
  LaTeX.vector(obj.to_a)
170
170
  end
171
171
 
172
+ type { Numo::NArray }
173
+ format 'text/latex' do |obj|
174
+ obj.ndim == 2 ?
175
+ LaTeX.matrix(obj, obj.shape[0], obj.shape[1]) :
176
+ LaTeX.vector(obj.to_a)
177
+ end
178
+ format 'text/html' do |obj|
179
+ HTML.table(obj.to_a)
180
+ end
181
+
172
182
  type { NArray }
173
183
  format 'text/latex' do |obj|
174
184
  obj.dim == 2 ?
@@ -178,6 +178,55 @@
178
178
  "end"
179
179
  ]
180
180
  },
181
+ {
182
+ "cell_type": "markdown",
183
+ "metadata": {},
184
+ "source": [
185
+ "## Defaults\n",
186
+ "\n",
187
+ "Most inputs will accept a `default` parameter. If no default is given, the deault is `nil`. Since checkboxes can have multiple values selected, you can pass an array of values. To check everything, pass `true` as the default. "
188
+ ]
189
+ },
190
+ {
191
+ "cell_type": "code",
192
+ "execution_count": null,
193
+ "metadata": {
194
+ "collapsed": false
195
+ },
196
+ "outputs": [],
197
+ "source": [
198
+ "result = IRuby.form do \n",
199
+ " checkbox :one, 'Fish', 'Cat', 'Dog', default: 'Fish'\n",
200
+ " checkbox :many, 'Fish', 'Cat', 'Dog', default: ['Cat', 'Dog']\n",
201
+ " checkbox :all, 'Fish', 'Cat', 'Dog', default: true\n",
202
+ " button :submit, label: 'All done'\n",
203
+ "end"
204
+ ]
205
+ },
206
+ {
207
+ "cell_type": "markdown",
208
+ "metadata": {},
209
+ "source": [
210
+ "## Dates\n",
211
+ "\n",
212
+ "The `date` widget provides a calendar popup and returns a `Time` object. It's default should also be a `Time` object. "
213
+ ]
214
+ },
215
+ {
216
+ "cell_type": "code",
217
+ "execution_count": null,
218
+ "metadata": {
219
+ "collapsed": false
220
+ },
221
+ "outputs": [],
222
+ "source": [
223
+ "result = IRuby.form do \n",
224
+ " date :birthday\n",
225
+ " date :today, default: Time.now\n",
226
+ " button\n",
227
+ "end"
228
+ ]
229
+ },
181
230
  {
182
231
  "cell_type": "markdown",
183
232
  "metadata": {},
@@ -256,7 +305,7 @@
256
305
  "source": [
257
306
  "## Dropdowns\n",
258
307
  "\n",
259
- "Selects are dropdowns of options. By default, the first supplied option is selected. If you don't want any default value, use `nil` as the first parameter. "
308
+ "A `select` is a dropdown of options. Use a `multiple` to allow multiple selections. `multiple` widgets accept an additional `size` parameters that determines the number of rows. The default is 4. "
260
309
  ]
261
310
  },
262
311
  {
@@ -268,8 +317,11 @@
268
317
  "outputs": [],
269
318
  "source": [
270
319
  "result = IRuby.form do \n",
271
- " text 'Do you have a favorite Stooge?' \n",
272
- " select :stooge, nil, 'Moe', 'Larry', 'Curly'\n",
320
+ " select :stooge, 'Moe', 'Larry', 'Curly'\n",
321
+ " select :stooge, 'Moe', 'Larry', 'Curly', default: 'Moe'\n",
322
+ " multiple :stooges, 'Moe', 'Larry', 'Curly', default: true, size: 3\n",
323
+ " multiple :stooges, 'Moe', 'Larry', 'Curly', default: ['Moe','Curly']\n",
324
+ " button\n",
273
325
  "end"
274
326
  ]
275
327
  },
@@ -21,4 +21,5 @@ require 'iruby/input/select'
21
21
  require 'iruby/input/checkbox'
22
22
  require 'iruby/input/radio'
23
23
  require 'iruby/input/textarea'
24
- require 'iruby/input/date'
24
+ require 'iruby/input/date'
25
+ require 'iruby/input/multiple'
@@ -1,7 +1,7 @@
1
1
  module IRuby
2
2
  module Input
3
3
  class Checkbox < Label
4
- needs :options
4
+ needs :options, :default
5
5
 
6
6
  builder :checkbox do |*args, **params|
7
7
  key = :checkbox
@@ -9,11 +9,24 @@ module IRuby
9
9
 
10
10
  params[:key] = unique_key(key)
11
11
  params[:options] = args
12
+
13
+ params[:default] = case params[:default]
14
+ when false, nil
15
+ []
16
+ when true
17
+ [*params[:options]]
18
+ else
19
+ [*params[:default]]
20
+ end
21
+
12
22
  add_field Checkbox.new(**params)
13
23
  end
14
24
 
15
25
  def widget_css
16
- '.iruby-checkbox-container { margin-left: 10px; }'
26
+ <<-CSS
27
+ .iruby-checkbox.form-control { display: inline-table; }
28
+ .iruby-checkbox .checkbox-inline { margin: 0 15px 0 0; }
29
+ CSS
17
30
  end
18
31
 
19
32
  def widget_js
@@ -30,6 +43,8 @@ module IRuby
30
43
  $(parent).data('iruby-value', null);
31
44
  }
32
45
  });
46
+
47
+ $('.iruby-checkbox input').trigger('change');
33
48
  JS
34
49
  end
35
50
 
@@ -43,7 +58,10 @@ module IRuby
43
58
  @options.each do |option|
44
59
  label class: 'checkbox-inline' do
45
60
  input(
46
- name: @key, value: option, type: 'checkbox'
61
+ name: @key,
62
+ value: option,
63
+ type: 'checkbox',
64
+ checked: @default.include?(option)
47
65
  )
48
66
  text option
49
67
  end
@@ -1,26 +1,37 @@
1
1
  module IRuby
2
2
  module Input
3
3
  class Date < Field
4
- needs js_class: 'iruby-date'
4
+ needs js_class: 'iruby-date', icon: '📅'
5
5
 
6
6
  builder :date do |key='date', **params|
7
+ params[:default] ||= false
7
8
  params[:key] = unique_key key
9
+
10
+ if params[:default].is_a? Time
11
+ params[:default] = params[:default].strftime('%m/%d/%Y')
12
+ end
13
+
8
14
  add_field Date.new(**params)
15
+
16
+ process params[:key] do |result,key,value|
17
+ result[key.to_sym] = Time.strptime(value,'%m/%d/%Y')
18
+ end
9
19
  end
10
20
 
11
21
  def widget_css
12
- '#ui-datepicker-div { z-index: 2000; }'
22
+ '#ui-datepicker-div { z-index: 2000 !important; }'
13
23
  end
14
24
 
15
25
  def widget_js
16
26
  <<-JS
17
27
  $('.iruby-date').datepicker({
28
+ dateFormat: 'mm/dd/yy',
18
29
  onClose: function(date) {
19
- $('.iruby-date').data('iruby-value', date);
30
+ $(this).data('iruby-value', date);
20
31
  }
21
32
  });
22
33
  JS
23
34
  end
24
35
  end
25
36
  end
26
- end
37
+ end
@@ -1,7 +1,7 @@
1
1
  module IRuby
2
2
  module Input
3
3
  class Field < Label
4
- needs :type => 'text', js_class: 'iruby-field'
4
+ needs default: nil, type: 'text', js_class: 'iruby-field'
5
5
 
6
6
  builder :input do |key='input', **params|
7
7
  params[:key] = unique_key key
@@ -21,7 +21,8 @@ module IRuby
21
21
  input(
22
22
  type: @type,
23
23
  :'data-iruby-key' => @key,
24
- class: "form-control #{@js_class}"
24
+ class: "form-control #{@js_class}",
25
+ value: @default
25
26
  )
26
27
  end
27
28
  end
@@ -1,13 +1,19 @@
1
1
  module IRuby
2
2
  module Input
3
3
  class Label < Widget
4
- needs label: nil
4
+ needs label: nil, icon: nil
5
5
 
6
6
  def widget_label
7
- label = @label || to_label(@key)
8
- div class: 'iruby-label input-group' do
9
- span label, class: 'input-group-addon'
7
+ div class: 'iruby-label input-group' do
8
+ span class: 'input-group-addon' do
9
+ text @label || to_label(@key)
10
+ end
11
+
10
12
  yield
13
+
14
+ if @icon
15
+ span @icon, class: "input-group-addon"
16
+ end
11
17
  end
12
18
  end
13
19
 
@@ -0,0 +1,76 @@
1
+ module IRuby
2
+ module Input
3
+ class Multiple < Label
4
+ needs :options, :default, size: nil
5
+
6
+ builder :multiple do |*args, **params|
7
+ key = :multiple
8
+ key, *args = args if args.first.is_a? Symbol
9
+
10
+ params[:key] = unique_key(key)
11
+ params[:options] = args
12
+
13
+ params[:default] = case params[:default]
14
+ when false, nil
15
+ []
16
+ when true
17
+ [*params[:options]]
18
+ else
19
+ [*params[:default]]
20
+ end
21
+
22
+ add_field Multiple.new(**params)
23
+ end
24
+
25
+ def widget_css
26
+ <<-CSS
27
+ .iruby-multiple {
28
+ display: table;
29
+ min-width: 25%;
30
+ }
31
+ .form-control.iruby-multiple-container {
32
+ display: table;
33
+ }
34
+ CSS
35
+ end
36
+
37
+ def widget_js
38
+ <<-JS
39
+ $('.iruby-multiple').change(function(){
40
+ var multiple = $(this);
41
+ multiple.data('iruby-value', []);
42
+
43
+ multiple.find(':selected').each(function(){
44
+ multiple.data('iruby-value').push($(this).val());
45
+ });
46
+
47
+ if (multiple.data('iruby-value').length == 0) {
48
+ multiple.data('iruby-value', null);
49
+ }
50
+ });
51
+
52
+ $('.iruby-multiple').trigger('change');
53
+ JS
54
+ end
55
+
56
+ def widget_html
57
+ widget_label do
58
+ div class: 'form-control iruby-multiple-container' do
59
+ params = {
60
+ size: @size,
61
+ multiple: true,
62
+ class: 'iruby-multiple',
63
+ :'data-iruby-key' => @key
64
+ }
65
+
66
+ select **params do
67
+ @options.each do |o|
68
+ option o, selected: @default.include?(o)
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
@@ -21,9 +21,12 @@ module IRuby
21
21
  #{widget_join :widget_js, @form, *@buttons}
22
22
 
23
23
  var popup = $(this);
24
+
24
25
  $('#iruby-form').submit(function() {
25
26
  popup.modal('hide');
26
- })
27
+ });
28
+
29
+ Jupyter.notebook.keyboard_manager.disable();
27
30
  }
28
31
  });
29
32
 
@@ -35,4 +38,4 @@ module IRuby
35
38
  end
36
39
  end
37
40
  end
38
- end
41
+ end
@@ -1,7 +1,7 @@
1
1
  module IRuby
2
2
  module Input
3
3
  class Radio < Label
4
- needs :options
4
+ needs :options, :default
5
5
 
6
6
  builder :radio do |*args, **params|
7
7
  key = :radio
@@ -9,9 +9,17 @@ module IRuby
9
9
 
10
10
  params[:key] = unique_key(key)
11
11
  params[:options] = args
12
+ params[:default] ||= false
12
13
  add_field Radio.new(**params)
13
14
  end
14
15
 
16
+ def widget_css
17
+ <<-CSS
18
+ .iruby-radio.form-control { display: inline-table; }
19
+ .iruby-radio .radio-inline { margin: 0 15px 0 0; }
20
+ CSS
21
+ end
22
+
15
23
  def widget_js
16
24
  <<-JS
17
25
  $('.iruby-radio input').change(function(){
@@ -20,6 +28,7 @@ module IRuby
20
28
  $(parent).find(':checked').val()
21
29
  );
22
30
  });
31
+ $('.iruby-radio input').trigger('change');
23
32
  JS
24
33
  end
25
34
 
@@ -34,7 +43,10 @@ module IRuby
34
43
  @options.each do |option|
35
44
  label class: 'radio-inline' do
36
45
  input(
37
- name: @key, value: option, type: 'radio'
46
+ name: @key,
47
+ value: option,
48
+ type: 'radio',
49
+ checked: @default == option
38
50
  )
39
51
  text option
40
52
  end
@@ -1,18 +1,30 @@
1
1
  module IRuby
2
2
  module Input
3
3
  class Select < Label
4
- needs :options
4
+ needs :options, :default
5
5
 
6
6
  builder :select do |*args, **params|
7
7
  key = :select
8
8
  key, *args = args if args.first.is_a? Symbol
9
9
 
10
- key = unique_key(key)
11
- add_field Select.new(key: key, options: args)
10
+ params[:key] = unique_key(key)
11
+ params[:options] = args
12
+ params[:default] ||= false
13
+
14
+ unless params[:options].include? params[:default]
15
+ params[:options] = [nil, *params[:options].compact]
16
+ end
17
+
18
+ add_field Select.new(**params)
12
19
  end
13
20
 
14
21
  def widget_css
15
- '.iruby-select { margin-left: 0 !important }'
22
+ <<-CSS
23
+ .iruby-select {
24
+ min-width: 25%;
25
+ margin-left: 0 !important;
26
+ }
27
+ CSS
16
28
  end
17
29
 
18
30
  def widget_js
@@ -31,11 +43,13 @@ module IRuby
31
43
  params = {
32
44
  class: 'iruby-select',
33
45
  :'data-iruby-key' => @key,
34
- :'data-iruby-value' => @options.first
46
+ :'data-iruby-value' => @default
35
47
  }
36
48
 
37
49
  select **params do
38
- @options.each {|o| option o }
50
+ @options.each do |o|
51
+ option o, selected: @default == o
52
+ end
39
53
  end
40
54
  end
41
55
  end
@@ -11,6 +11,7 @@ module IRuby
11
11
  def widget_html
12
12
  widget_label do
13
13
  textarea(
14
+ @default,
14
15
  rows: @rows,
15
16
  :'data-iruby-key' => @key,
16
17
  class: 'form-control iruby-field'
@@ -109,7 +109,7 @@ module IRuby
109
109
  def complete_request(msg)
110
110
  # HACK for #26, only complete last line
111
111
  code = msg[:content]['code']
112
- if start = code.rindex("\n")
112
+ if start = code.rindex(/\s|\R/)
113
113
  code = code[start+1..-1]
114
114
  start += 1
115
115
  end
@@ -0,0 +1,66 @@
1
+ require 'cztop'
2
+
3
+ module IRuby
4
+ class Session
5
+ include SessionSerialize
6
+
7
+ def initialize(config)
8
+ connection = "#{config['transport']}://#{config['ip']}:%d"
9
+
10
+ reply_socket = CZTop::Socket::ROUTER.new(connection % config['shell_port'])
11
+ pub_socket = CZTop::Socket::PUB.new(connection % config['iopub_port'])
12
+ stdin_socket = CZTop::Socket::ROUTER.new(connection % config['stdin_port'])
13
+
14
+ Thread.new do
15
+ begin
16
+ hb_socket = CZTop::Socket::REP.new(connection % config['hb_port'])
17
+ loop do
18
+ message = hb_socket.receive
19
+ hb_socket << message
20
+ end
21
+ rescue Exception => e
22
+ IRuby.logger.fatal "Kernel heartbeat died: #{e.message}\n#{e.backtrace.join("\n")}"
23
+ end
24
+ end
25
+
26
+ @sockets = {
27
+ publish: pub_socket,
28
+ reply: reply_socket,
29
+ stdin: stdin_socket,
30
+ }
31
+
32
+ @session = SecureRandom.uuid
33
+ unless config['key'].to_s.empty? || config['signature_scheme'].to_s.empty?
34
+ raise 'Unknown signature scheme' unless config['signature_scheme'] =~ /\Ahmac-(.*)\Z/
35
+ @hmac = OpenSSL::HMAC.new(config['key'], OpenSSL::Digest.new($1))
36
+ end
37
+ end
38
+
39
+ # Build and send a message
40
+ def send(socket, type, content)
41
+ idents =
42
+ if socket == :reply && @last_recvd_msg
43
+ @last_recvd_msg[:idents]
44
+ else
45
+ type == :stream ? "stream.#{content[:name]}" : type
46
+ end
47
+ header = {
48
+ msg_type: type,
49
+ msg_id: SecureRandom.uuid,
50
+ username: 'kernel',
51
+ session: @session,
52
+ version: '5.0'
53
+ }
54
+ @sockets[socket] << serialize(idents, header, content)
55
+ end
56
+
57
+ # Receive a message and decode it
58
+ def recv(socket)
59
+ @last_recvd_msg = unserialize(@sockets[socket].receive)
60
+ end
61
+
62
+ def recv_input
63
+ unserialize(@sockets[:stdin].receive)[:content]["value"]
64
+ end
65
+ end
66
+ end
@@ -67,7 +67,7 @@ module IRuby
67
67
  while msg.empty? || socket.more_parts?
68
68
  begin
69
69
  frame = ''
70
- rc = socket.recv_string(frame, 1)
70
+ rc = socket.recv_string(frame)
71
71
  ZMQ::Util.error_check('zmq_msg_send', rc)
72
72
  msg << frame
73
73
  rescue
@@ -1,3 +1,3 @@
1
1
  module IRuby
2
- VERSION = '0.2.9'
2
+ VERSION = '0.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: '0.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Mendler
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-05-03 00:00:00.000000000 Z
12
+ date: 2017-03-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -136,6 +136,7 @@ files:
136
136
  - lib/iruby/input/file.rb
137
137
  - lib/iruby/input/form.rb
138
138
  - lib/iruby/input/label.rb
139
+ - lib/iruby/input/multiple.rb
139
140
  - lib/iruby/input/popup.rb
140
141
  - lib/iruby/input/radio.rb
141
142
  - lib/iruby/input/select.rb
@@ -144,6 +145,7 @@ files:
144
145
  - lib/iruby/kernel.rb
145
146
  - lib/iruby/logger.rb
146
147
  - lib/iruby/ostream.rb
148
+ - lib/iruby/session/cztop.rb
147
149
  - lib/iruby/session/ffi_rzmq.rb
148
150
  - lib/iruby/session/mixin.rb
149
151
  - lib/iruby/session/rbczmq.rb
@@ -183,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
185
  version: '0'
184
186
  requirements: []
185
187
  rubyforge_project:
186
- rubygems_version: 2.4.6
188
+ rubygems_version: 2.5.2
187
189
  signing_key:
188
190
  specification_version: 4
189
191
  summary: Ruby Kernel for Jupyter/IPython
@@ -191,4 +193,3 @@ test_files:
191
193
  - test/integration_test.rb
192
194
  - test/iruby/multi_logger_test.rb
193
195
  - test/test_helper.rb
194
- has_rdoc: