universa 0.2.3 → 0.2.4

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: f74160e71e9ecbab5d26c3bc14717c2d1b6a3a251d109c00728f1e6d21dd9bae
4
- data.tar.gz: 84fb8e4ed5a1db8ab7226b47fb872fd8b605ee469dc2e004b67e3ea4274405f5
3
+ metadata.gz: e1074fb463df9773322f96a839584fe34062586a808296be953360f4dc0f7deb
4
+ data.tar.gz: 597cb764db52578dc54a2026ede9039cd0b7d58a00baaaed9966f4596f06cebf
5
5
  SHA512:
6
- metadata.gz: 9890b396912ca79946e53dd8c0281ed8e0dd8af765733e58633681d880de844c04ccd5f356de73575f5a5b09c4d3e896550b2d76b608eda131c55e1d7c1c2aa6
7
- data.tar.gz: b4292f597680e2f6f9558d008108f2c4fead1e42a73118c0fa154e2ae1a8c68f8b4829071d4e59acf6ec73ff2cff01f1ba0e5ad980a23f4aac664232bb2093d0
6
+ metadata.gz: 229f6752e523b12cb8f831c40df5c4906907c296ae6e3daf1ad29f26dfce85900d70ab55b91431ac94ed8d8c4761777cb54d6f109afaeb72a71a2ce921b0ae64
7
+ data.tar.gz: ac84e741062e461f0d4f3cfc8f86f946f37be818cd76541df806d3ab9fdf5114278698b83d6cc22ea74edce3fd7d3b69bcf7628948b83a507580225276500a66
@@ -235,30 +235,38 @@ module Universa
235
235
  # convert ruby arguments array to corresponding UMI values
236
236
  def prepare_args args
237
237
  raise "pp bug" if args == [:pretty_print] # this often happens whilte tracing
238
- args.map {|x|
239
- if x.respond_to?(:_as_umi_arg)
240
- x._as_umi_arg(self)
241
- else
242
- case x
243
- when Set
244
- # Make a Java Set
245
- r = call("instantiate", "Set", x.to_a.map {|i| i._as_umi_arg(self)})
246
- # Ref will garbage collect it
247
- Ref.new(self, r)
248
- # but we need a ref struct only:
249
- r
250
- when Time
251
- {__type: 'unixtime', seconds: x.to_i}
252
- when String
253
- x.encoding == Encoding::BINARY ? {__type: 'binary', base64: Base64.encode64(x)} : x
254
- when RemoteAdapter
255
- # this need special treatment with direct call:
256
- x.__getobj__._as_umi_arg(self)
257
- else
258
- x
259
- end
238
+ args.map {|x| prepare x }
239
+ end
240
+
241
+ # convert single argument to UMI value to pass
242
+ def prepare(x)
243
+ if x.respond_to?(:_as_umi_arg)
244
+ x._as_umi_arg(self)
245
+ else
246
+ case x
247
+ when Array
248
+ # deep convert all array items
249
+ x.map{|a| prepare a }
250
+ when Set
251
+ # Make a Java Set
252
+ r = call("instantiate", "Set", x.to_a.map {|i| i._as_umi_arg(self)})
253
+ # Ref will garbage collect it
254
+ Ref.new(self, r)
255
+ # but we need a ref struct only:
256
+ r
257
+ when Time
258
+ {__type: 'unixtime', seconds: x.to_i}
259
+ when String
260
+ x.encoding == Encoding::BINARY ? {__type: 'binary', base64: Base64.encode64(x)} : x
261
+ when Ref
262
+ x._as_umi_arg(self)
263
+ when RemoteAdapter
264
+ # this need special treatment with direct call:
265
+ x.__getobj__._as_umi_arg(self)
266
+ else
267
+ x
260
268
  end
261
- }
269
+ end
262
270
  end
263
271
 
264
272
  # Convert remote call result from UMI structures to ruby types
@@ -1,4 +1,4 @@
1
1
  module Universa
2
2
  # Current gem version
3
- VERSION = "0.2.3"
3
+ VERSION = "0.2.4"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: universa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - sergeych
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-12-13 00:00:00.000000000 Z
11
+ date: 2018-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: farcall