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 +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +0 -5
- data/infraruby-shim.gemspec +4 -4
- data/lib/infraruby-shim.rb +41 -0
- data/ruby/BasicObject.rb +5 -0
- data/ruby/Comparable.rb +7 -0
- data/ruby/Float32.rb +7 -0
- data/ruby/Float64.rb +7 -0
- data/ruby/InfraRuby/Condition.rb +3 -2
- data/ruby/InfraRuby/StringBuilder.rb +26 -30
- data/ruby/Int16.rb +7 -0
- data/ruby/Int32.rb +9 -0
- data/ruby/Int64.rb +9 -0
- data/ruby/Integer.rb +2 -0
- data/ruby/JAVA.rb +18 -0
- data/ruby/Object.rb +1 -3
- data/ruby/SecureRandom.rb +5 -5
- metadata +17 -9
- data/ruby/InfraRuby/IO.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06fc05930b2a98bf1655c1fa083a70ef67a42f1d
|
4
|
+
data.tar.gz: 6de9d19931a545541506c9dcca906b9f18832073
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30bbd09ac2346ed0e87c9fee09e934adf1870ba3d74a68356a18faac82e5ca0142e5aeda761da7f60a43c3a85a7b86b237939254b3245ae41b4373f7fe326438
|
7
|
+
data.tar.gz: baa613fb294e29d4fd058bdb10806453b8ab4f6c7482ab961accf59005bce523eb9d8d240fe3120e8fed92434f56312e6313b5949a38061f9a22cbcfc22a146f
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
data/infraruby-shim.gemspec
CHANGED
@@ -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 = "
|
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", "~>
|
13
|
-
s.add_runtime_dependency "infraruby-java", "~>
|
14
|
-
s.add_development_dependency "infraruby-task", "~>
|
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
|
data/lib/infraruby-shim.rb
CHANGED
@@ -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
|
data/ruby/BasicObject.rb
ADDED
data/ruby/Comparable.rb
ADDED
data/ruby/Float32.rb
ADDED
data/ruby/Float64.rb
ADDED
data/ruby/InfraRuby/Condition.rb
CHANGED
@@ -1,50 +1,50 @@
|
|
1
1
|
module InfraRuby
|
2
2
|
class StringBuilder
|
3
|
-
include InfraRuby::
|
3
|
+
include InfraRuby::Writer
|
4
4
|
|
5
5
|
def initialize
|
6
6
|
super()
|
7
|
-
@m =
|
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 =
|
14
|
-
|
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
|
-
|
20
|
-
raise RuntimeError if
|
21
|
-
if
|
22
|
-
|
23
|
-
raise RuntimeError if
|
24
|
-
@m = __copy(
|
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
|
27
|
-
@n =
|
26
|
+
@m[@n] = b
|
27
|
+
@n = n
|
28
28
|
return
|
29
29
|
end
|
30
30
|
|
31
31
|
def __write_array(m)
|
32
|
-
|
33
|
-
if
|
34
|
-
|
35
|
-
raise RuntimeError if
|
36
|
-
if
|
37
|
-
|
38
|
-
raise RuntimeError if
|
39
|
-
@m = __copy(
|
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
|
-
|
42
|
-
@n =
|
41
|
+
JAVA::ARRAYCOPY(m, 0, @m, @n, d)
|
42
|
+
@n = n
|
43
43
|
end
|
44
44
|
return
|
45
45
|
end
|
46
46
|
|
47
|
-
def
|
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.
|
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
|
60
|
+
when JAVA::byte[]
|
65
61
|
__write_array(o)
|
66
62
|
return
|
67
63
|
when String
|
68
|
-
__write_array(o.
|
64
|
+
__write_array(o.to_j_bytes_unsafe)
|
69
65
|
return
|
70
66
|
else
|
71
67
|
raise TypeError
|
data/ruby/Int16.rb
ADDED
data/ruby/Int32.rb
ADDED
data/ruby/Int64.rb
ADDED
data/ruby/Integer.rb
CHANGED
data/ruby/JAVA.rb
ADDED
@@ -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
|
data/ruby/Object.rb
CHANGED
data/ruby/SecureRandom.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
module SecureRandom
|
2
2
|
class << self
|
3
|
-
def
|
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.
|
7
|
+
s = random_bytes(o.as_ruby)
|
8
8
|
end
|
9
|
-
return s.
|
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.
|
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.
|
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:
|
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:
|
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: '
|
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: '
|
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: '
|
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: '
|
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: '
|
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: '
|
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:
|