infraruby-shim 3.7.0 → 4.0.0

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: e8cff7e460cc859c8b703028fe7617ae9d578dcc
4
- data.tar.gz: c3cdace46988d6043515237df6094f922a7b2b95
3
+ metadata.gz: 06fc05930b2a98bf1655c1fa083a70ef67a42f1d
4
+ data.tar.gz: 6de9d19931a545541506c9dcca906b9f18832073
5
5
  SHA512:
6
- metadata.gz: b664d75c77887bb485e3a337f677fb6a645059f79b240b12e2aec77070f2caa0e401c55d77df600962865f02c13ed3d4387de4d9aeb01771a06875eb0116805f
7
- data.tar.gz: 0383e6869687be27aa1caa17736c76b5ef0ea5694065ed68282ec81d49513d273bd34dee558876a9b8b31571c14b8fd64fbf28325c80ad8347b14420698cf923
6
+ metadata.gz: 30bbd09ac2346ed0e87c9fee09e934adf1870ba3d74a68356a18faac82e5ca0142e5aeda761da7f60a43c3a85a7b86b237939254b3245ae41b4373f7fe326438
7
+ data.tar.gz: baa613fb294e29d4fd058bdb10806453b8ab4f6c7482ab961accf59005bce523eb9d8d240fe3120e8fed92434f56312e6313b5949a38061f9a22cbcfc22a146f
@@ -1,4 +1,4 @@
1
- Copyright (C) 2011-2015 InfraRuby Vision
1
+ Copyright (C) 2011-2016 InfraRuby Vision
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a
4
4
  copy of this software and associated documentation files (the "Software"),
data/README.md CHANGED
@@ -17,9 +17,4 @@ Example
17
17
  Support
18
18
  -------
19
19
 
20
- InfraRuby Vision
21
- rubygems@infraruby.com
22
-
23
20
  http://infraruby.com/
24
- https://github.com/InfraRuby
25
- https://twitter.com/InfraRuby
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.platform = "ruby"
3
3
  s.name = "infraruby-shim"
4
- s.version = "3.7.0"
4
+ s.version = "4.0.0"
5
5
  s.licenses = ["MIT"]
6
6
  s.author = "InfraRuby Vision"
7
7
  s.email = "rubygems@infraruby.com"
@@ -9,8 +9,8 @@ Gem::Specification.new do |s|
9
9
  s.summary = "InfraRuby shim for Ruby interpreters"
10
10
  s.description = "InfraRuby shim for Ruby interpreters"
11
11
  s.files = Dir["**/*"]
12
- s.add_runtime_dependency "infraruby-base", "~> 3.7"
13
- s.add_runtime_dependency "infraruby-java", "~> 3.7"
14
- s.add_development_dependency "infraruby-task", "~> 3.7"
12
+ s.add_runtime_dependency "infraruby-base", "~> 4.0"
13
+ s.add_runtime_dependency "infraruby-java", "~> 4.0"
14
+ s.add_development_dependency "infraruby-task", "~> 4.0"
15
15
  s.add_development_dependency "rspec", "~> 3.0"
16
16
  end
@@ -1,3 +1,44 @@
1
1
  require "infraruby-java"
2
2
 
3
+ module InfraRuby
4
+ module Index
5
+ end
6
+
7
+ module Closer
8
+ end
9
+
10
+ module Reader
11
+ include Closer
12
+ end
13
+
14
+ module Writer
15
+ include Closer
16
+
17
+ def <<(o)
18
+ write(o)
19
+ return self
20
+ end
21
+ end
22
+ end
23
+
24
+ InfraRuby.if(RUBY_ENGINE == "ruby") {
25
+
26
+ JAVA.module_eval do
27
+ __package(:java) {
28
+ __package(:lang) {
29
+ __interface "Cloneable" do
30
+ end
31
+
32
+ __interface "Comparable" do
33
+ end
34
+ }
35
+ }
36
+ end
37
+
38
+ }
39
+
3
40
  InfraRuby.load_parent_library(__dir__)
41
+
42
+ [Numeric, String, Symbol, Date, Time].each do |c|
43
+ c.include(Comparable)
44
+ end
@@ -0,0 +1,5 @@
1
+ class BasicObject
2
+ def checkcast(s)
3
+ return self
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ module Comparable
2
+ include JAVA::java.lang.Comparable
3
+
4
+ def compareTo(t)
5
+ return (self <=> t).signum_as_int32
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ class Float32
2
+ include JAVA::java.lang.Comparable
3
+
4
+ def compareTo(o)
5
+ return self <=> o
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ class Float64
2
+ include JAVA::java.lang.Comparable
3
+
4
+ def compareTo(o)
5
+ return self <=> o
6
+ end
7
+ end
@@ -10,10 +10,11 @@ module InfraRuby
10
10
  def await(timeout = nix)
11
11
  if timeout.nix?
12
12
  @cv.wait(@mutex)
13
+ return
13
14
  else
14
- @cv.wait(@mutex, timeout)
15
+ @cv.wait(@mutex, timeout.as_ruby)
16
+ return true
15
17
  end
16
- return
17
18
  end
18
19
 
19
20
  def broadcast
@@ -1,50 +1,50 @@
1
1
  module InfraRuby
2
2
  class StringBuilder
3
- include InfraRuby::IO
3
+ include InfraRuby::Writer
4
4
 
5
5
  def initialize
6
6
  super()
7
- @m = Java::byte[0x20].new
7
+ @m = JAVA::byte[0x20].new
8
8
  @n = 0.i32
9
9
  return
10
10
  end
11
11
 
12
12
  def __copy(n)
13
- m = Java::byte[n.as_i].new
14
- Java::ARRAYCOPY(@m, 0, m, 0, @n.as_i)
13
+ m = JAVA::byte[n].new
14
+ JAVA::ARRAYCOPY(@m, 0, m, 0, @n)
15
15
  return m
16
16
  end
17
17
 
18
18
  def __write_byte(b)
19
- nn = @n + 1
20
- raise RuntimeError if nn < 0
21
- if nn > @m.length
22
- nnn = nn + nn / 2
23
- raise RuntimeError if nnn < 0
24
- @m = __copy(nnn)
19
+ n = @n + 1
20
+ raise RuntimeError if n < 0
21
+ if n > @m.length
22
+ nn = n + n / 2
23
+ raise RuntimeError if nn < 0
24
+ @m = __copy(nn)
25
25
  end
26
- @m[@n.as_i] = b.as_i
27
- @n = nn
26
+ @m[@n] = b
27
+ @n = n
28
28
  return
29
29
  end
30
30
 
31
31
  def __write_array(m)
32
- n = m.length.i32
33
- if n > 0
34
- nn = @n + n
35
- raise RuntimeError if nn < 0
36
- if nn > @m.length
37
- nnn = nn + nn / 2
38
- raise RuntimeError if nnn < 0
39
- @m = __copy(nnn)
32
+ d = m.length
33
+ if d > 0
34
+ n = @n + d
35
+ raise RuntimeError if n < 0
36
+ if n > @m.length
37
+ nn = n + n / 2
38
+ raise RuntimeError if nn < 0
39
+ @m = __copy(nn)
40
40
  end
41
- Java::ARRAYCOPY(m, 0, @m, @n.as_i, n.as_i)
42
- @n = nn
41
+ JAVA::ARRAYCOPY(m, 0, @m, @n, d)
42
+ @n = n
43
43
  end
44
44
  return
45
45
  end
46
46
 
47
- def to_java_bytes
47
+ def to_j_bytes
48
48
  return __copy(@__n)
49
49
  end
50
50
 
@@ -52,20 +52,16 @@ module InfraRuby
52
52
  if encoding.nix?
53
53
  encoding = Encoding::UTF_8
54
54
  end
55
- return String.from_java_bytes_unsafe(__copy(@n), encoding)
56
- end
57
-
58
- def read(o = nix)
59
- raise NotImplementedError
55
+ return String.from_j_bytes_unsafe(__copy(@n)).with_encoding(encoding)
60
56
  end
61
57
 
62
58
  def write(o)
63
59
  case o
64
- when Java::byte[]
60
+ when JAVA::byte[]
65
61
  __write_array(o)
66
62
  return
67
63
  when String
68
- __write_array(o.to_java_bytes_unsafe)
64
+ __write_array(o.to_j_bytes_unsafe)
69
65
  return
70
66
  else
71
67
  raise TypeError
@@ -0,0 +1,7 @@
1
+ class Int16
2
+ include JAVA::java.lang.Comparable
3
+
4
+ def compareTo(o)
5
+ return self <=> o
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ class Int32
2
+ include InfraRuby::Index
3
+
4
+ include JAVA::java.lang.Comparable
5
+
6
+ def compareTo(o)
7
+ return self <=> o
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class Int64
2
+ include InfraRuby::Index
3
+
4
+ include JAVA::java.lang.Comparable
5
+
6
+ def compareTo(o)
7
+ return self <=> o
8
+ end
9
+ end
@@ -1,4 +1,6 @@
1
1
  class Integer
2
+ include InfraRuby::Index
3
+
2
4
  def is_a?(c)
3
5
  return c === self
4
6
  end
@@ -0,0 +1,18 @@
1
+ JAVA::java.lang.Throwable.class_eval do
2
+ def message
3
+ s = getMessage
4
+ if s.nil?
5
+ return getClass.getName.to_s
6
+ else
7
+ return s.to_s
8
+ end
9
+ end
10
+
11
+ def backtrace
12
+ a = []
13
+ getStackTrace.each do |e|
14
+ a.push("#{e.getFileName}:#{e.getLineNumber}:in `#{e.getMethodName}'")
15
+ end
16
+ return a
17
+ end
18
+ end
@@ -1,5 +1,3 @@
1
1
  class Object
2
- def cast(s)
3
- return self
4
- end
2
+ include JAVA::java.lang.Cloneable
5
3
  end
@@ -1,19 +1,19 @@
1
1
  module SecureRandom
2
2
  class << self
3
- def random_java_bytes(o = nix)
3
+ def random_j_bytes(o = nix)
4
4
  if o.nix?
5
5
  s = random_bytes
6
6
  else
7
- s = random_bytes(o.as_i)
7
+ s = random_bytes(o.as_ruby)
8
8
  end
9
- return s.to_java_bytes_unsafe
9
+ return s.to_j_bytes_unsafe
10
10
  end
11
11
 
12
12
  def random_number_as_int32(o = nix)
13
13
  if o.nix?
14
14
  return Int32[random_number(1 << 32)]
15
15
  else
16
- return Int32[random_number(o.as_i)]
16
+ return Int32[random_number(o.as_ruby)]
17
17
  end
18
18
  end
19
19
 
@@ -21,7 +21,7 @@ module SecureRandom
21
21
  if o.nix?
22
22
  return Int64[random_number(1 << 64)]
23
23
  else
24
- return Int64[random_number(o.as_i)]
24
+ return Int64[random_number(o.as_ruby)]
25
25
  end
26
26
  end
27
27
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infraruby-shim
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - InfraRuby Vision
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-27 00:00:00.000000000 Z
11
+ date: 2016-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: infraruby-base
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.7'
19
+ version: '4.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.7'
26
+ version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: infraruby-java
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '3.7'
33
+ version: '4.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '3.7'
40
+ version: '4.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: infraruby-task
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '3.7'
47
+ version: '4.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '3.7'
54
+ version: '4.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -77,17 +77,24 @@ files:
77
77
  - infraruby-shim.gemspec
78
78
  - lib/infraruby-shim.rb
79
79
  - ruby/Array.rb
80
+ - ruby/BasicObject.rb
80
81
  - ruby/Bignum.rb
82
+ - ruby/Comparable.rb
81
83
  - ruby/Date.rb
82
84
  - ruby/Enumerable.rb
83
85
  - ruby/Fixnum.rb
84
86
  - ruby/Float.rb
87
+ - ruby/Float32.rb
88
+ - ruby/Float64.rb
85
89
  - ruby/Hash.rb
86
90
  - ruby/InfraRuby.rb
87
91
  - ruby/InfraRuby/Condition.rb
88
- - ruby/InfraRuby/IO.rb
89
92
  - ruby/InfraRuby/StringBuilder.rb
93
+ - ruby/Int16.rb
94
+ - ruby/Int32.rb
95
+ - ruby/Int64.rb
90
96
  - ruby/Integer.rb
97
+ - ruby/JAVA.rb
91
98
  - ruby/MatchData.rb
92
99
  - ruby/Object.rb
93
100
  - ruby/SecureRandom.rb
@@ -119,3 +126,4 @@ signing_key:
119
126
  specification_version: 4
120
127
  summary: InfraRuby shim for Ruby interpreters
121
128
  test_files: []
129
+ has_rdoc:
@@ -1,8 +0,0 @@
1
- module InfraRuby
2
- module IO
3
- end
4
- end
5
-
6
- class IO
7
- include InfraRuby::IO
8
- end