h8 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1fbec1007c8688390ed4e78bcb8fb828d6f1335a
4
- data.tar.gz: 1fc40b29112ab15dc624aea10bb21e7e136d353c
3
+ metadata.gz: c147d817635f52206f230a99f941ededb8bd21f5
4
+ data.tar.gz: d771197accf297eab3aa8e9044c13ff410321a46
5
5
  SHA512:
6
- metadata.gz: 886728e46a82de26977f1c3d517b1ec2d719ed9828cc47782eb6f13fe520928af145e409aab5de52b5ea780f9301f5983a4fe85827f2f6dd9b5155e155c283a5
7
- data.tar.gz: 848d3efdb932098ac8d756e9bee535f222c6af8a66e4dcb17203024c9d70152767692535c8eb12067b48c51652de9b2a4bf8c54d949a5d8394e41aa628c7296a
6
+ metadata.gz: 48336caaf28e4ed9eccd01585ae265a90b5f1de45ec27aa5b7901809aaee1856c7c5557cb2467cbc46a5e53c9d9c290fd894485b7264046c8e6aa6bc0f31d84e
7
+ data.tar.gz: 23c4e7500daa48e91dbf043d7b293441c1a7bc054d451fded0b51d4a93579d7cab1822a551fbfc6a1497ad2d527552c5e87c2d30e69bc1996432adab4fc9e874
data/lib/h8/context.rb CHANGED
@@ -22,11 +22,7 @@ end
22
22
 
23
23
  class Object
24
24
  def __to_json
25
- if respond_to?(:as_json)
26
- as_json
27
- else
28
- JSON[JSON[self]]
29
- end
25
+ JSON.unparse self
30
26
  end
31
27
  end
32
28
 
data/lib/h8/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module H8
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.2"
3
3
  end
@@ -4,8 +4,4 @@
4
4
  @globalsIncluded = true
5
5
 
6
6
  RubyGate.prototype.toJSON = ->
7
- src = @__to_json
8
- res = {}
9
- for key in src.keys()
10
- res[key] = src[key]
11
- res
7
+ JSON.parse @__to_json
@@ -397,8 +397,8 @@ describe 'ruby gate' do
397
397
  it 'should process to_json' do
398
398
  begin
399
399
  cxt = H8::Context.new
400
- src = cxt[:h] = { 'hello' => 'world' }
401
- cxt.eval("JSON.stringify(h)").should == "{\"hello\":\"world\"}"
400
+ src = cxt[:h] = { 'hello' => { 'my' => 'world', 'arr' => [1,2,'tre'] } }
401
+ JSON[cxt.eval("JSON.stringify(h)")].should == src
402
402
  rescue H8::NestedError => e
403
403
  puts e.ruby_error.backtrace.join("\n")
404
404
  raise
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: h8
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - sergeych