iruby 0.7.1 → 0.7.2

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
  SHA256:
3
- metadata.gz: 11ac6e3f7e6588a384c9f149d6c3fe4060b7cea7d1ff6461c3ea1acc8cadebf6
4
- data.tar.gz: 4c57af32989ee7a9d7671220647279f727021d9e6d29f9d40bf1bed0e0fc4ec0
3
+ metadata.gz: 97c4aaa733ee27b0adb838ebed8d38cd67f857ef2466aa055105943df8647845
4
+ data.tar.gz: be54a5310326f5e052f07a2bb0625acb823618ab9b0a85dc0dedae01a86ebbc9
5
5
  SHA512:
6
- metadata.gz: a1d623a6b5b4e46c2845048241fa6abfd535d72e648fd431f42c21c7f895f72f29b2443d74339342e83c5017040ff5f55ff4b0442909649b1ef0afb452c0ba20
7
- data.tar.gz: '0394ca9c46e802a2532534058acc3af98c6e93e62a60cc035977af441c61145cfda13b224f8f1da1a8b90b48159f6aa858da7c939db2fed4f4329dcd5f2e9ea0'
6
+ metadata.gz: 19cb3579f143fa0b720bb1fddc1e50b17b910ba2484bd794e9d382e6b3d029675d8bda801f77b19a26afae69a9038f9779a8f50a93d4ae51dadfde53dd3168f0
7
+ data.tar.gz: 2f1adf37fb436345d110c87352bad3725ffba0068740c13e16bcd3f4be7132a9a8968bcecda43c257613d4ccd08ab7592c9bae27d60501ac393c54a0f86519cd
data/CHANGES.md CHANGED
@@ -1,3 +1,10 @@
1
+ # 0.7.2 (2021-06-23)
2
+
3
+ ## Bug Fixes
4
+
5
+ * Fix IRuby.table for Ruby >= 2.7 https://github.com/SciRuby/iruby/pull/305 (@topofocus)
6
+ * Fix PlainBackend to include modules https://github.com/SciRuby/iruby/issues/303 (@UliKuch, @mrkn)
7
+
1
8
  # 0.7.1 (2021-06-21)
2
9
 
3
10
  ## Enhancements
data/lib/iruby/backend.rb CHANGED
@@ -40,6 +40,7 @@ module IRuby
40
40
  require 'irb/completion'
41
41
  IRB.setup(nil)
42
42
  @main = TOPLEVEL_BINDING.eval("self").dup
43
+ init_main_object(@main)
43
44
  @workspace = IRB::WorkSpace.new(@main)
44
45
  @irb = IRB::Irb.new(@workspace)
45
46
  @eval_path = @irb.context.irb_path
@@ -58,6 +59,16 @@ module IRuby
58
59
  def complete(code)
59
60
  IRB::InputCompletor::CompletionProc.call(code)
60
61
  end
62
+
63
+ private
64
+
65
+ def init_main_object(main)
66
+ wrapper_module = Module.new
67
+ main.extend(wrapper_module)
68
+ main.define_singleton_method(:include) do |*args|
69
+ wrapper_module.include(*args)
70
+ end
71
+ end
61
72
  end
62
73
 
63
74
  class PryBackend
data/lib/iruby/utils.rb CHANGED
@@ -21,7 +21,7 @@ module IRuby
21
21
 
22
22
  # Format the given object into HTML table
23
23
  def table(s, **options)
24
- html(HTML.table(s, options))
24
+ html(HTML.table(s, **options))
25
25
  end
26
26
 
27
27
  # Treat the given string as LaTeX text
data/lib/iruby/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module IRuby
2
- VERSION = '0.7.1'
2
+ VERSION = '0.7.2'
3
3
  end
@@ -8,6 +8,12 @@ module IRubyTest
8
8
  assert_equal 3, @plainbackend.eval('1+2', false)
9
9
  end
10
10
 
11
+ def test_include_module
12
+ assert_nothing_raised do
13
+ @plainbackend.eval("include Math, Comparable", false)
14
+ end
15
+ end
16
+
11
17
  def test_complete_req
12
18
  assert_includes @plainbackend.complete('req'), 'require'
13
19
  end
@@ -26,6 +32,12 @@ module IRubyTest
26
32
  assert_equal 3, @prybackend.eval('1+2', false)
27
33
  end
28
34
 
35
+ def test_include_module
36
+ assert_nothing_raised do
37
+ @prybackend.eval("include Math, Comparable", false)
38
+ end
39
+ end
40
+
29
41
  def test_complete_req
30
42
  assert_includes @prybackend.complete('req'), 'require'
31
43
  end
@@ -0,0 +1,25 @@
1
+ module IRubyTest
2
+ class UtilsTest < TestBase
3
+ sub_test_case("IRuby.table") do
4
+ def setup
5
+ @data = {
6
+ X: [ 1, 2, 3 ],
7
+ Y: [ 4, 5, 6 ]
8
+ }
9
+ end
10
+ sub_test_case("without header: option") do
11
+ def test_table
12
+ result = IRuby.table(@data)
13
+ assert_include(result.object, "<th>X</th>")
14
+ end
15
+ end
16
+
17
+ sub_test_case("with header: false") do
18
+ def test_table
19
+ result = IRuby.table(@data, header: false)
20
+ assert_not_include(result.object, "<th>X</th>")
21
+ end
22
+ end
23
+ end
24
+ end
25
+ 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.7.1
4
+ version: 0.7.2
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: 2021-06-21 00:00:00.000000000 Z
12
+ date: 2021-06-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: data_uri
@@ -224,6 +224,7 @@ files:
224
224
  - test/iruby/session_adapter/session_adapter_test_base.rb
225
225
  - test/iruby/session_adapter_test.rb
226
226
  - test/iruby/session_test.rb
227
+ - test/iruby/utils_test.rb
227
228
  - test/run-test.rb
228
229
  homepage: https://github.com/SciRuby/iruby
229
230
  licenses:
@@ -264,4 +265,5 @@ test_files:
264
265
  - test/iruby/session_adapter/session_adapter_test_base.rb
265
266
  - test/iruby/session_adapter_test.rb
266
267
  - test/iruby/session_test.rb
268
+ - test/iruby/utils_test.rb
267
269
  - test/run-test.rb