jsonx 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ce7b568b144ff2599e078cf15310e3c1ff6f83a0
4
+ data.tar.gz: 1981a008ac18b0cdd3cb87e1cc7a897f8f1f8671
5
+ SHA512:
6
+ metadata.gz: 1599545fc5b477d1cdaa75f7323eb18b5fd5a431a53cc1906709081421ca4b68c15f14bc8a93daff5a7eccf34972a94ff50fa4268a2fe93881941f4abac7d30d
7
+ data.tar.gz: 6cf9507a72efa56299735ba82f91d471faa64f7c03fb8d5f957fa543f5c28cf21a166c3d75308389b5f70d5aafc87fd096a109473b3483e7612059ce48dc42e8
@@ -0,0 +1,2 @@
1
+ }8 j�}��o��i��w��>���*w?�����z�c�v]���Vb=t���b�!{h�/�&��!�ub8;O���.WW��ס-�
2
+ �*����[&"|x^��W�)���1� ܵ�.f9���s�@����
Binary file
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: jsonx.rb
4
+
5
+ require 'rexle'
6
+
7
+
8
+ class JSONx
9
+
10
+ attr_reader :to_s
11
+
12
+ def initialize()
13
+
14
+ types = {
15
+ Hash: ->(x, k, h){
16
+ type = 'json:object'
17
+ [type, '', {name: k},
18
+ *h.map {|k,v| types[v.class.to_s.to_sym].call(x, k, v)}
19
+ ]
20
+ },
21
+ Fixnum: ->(x, k, n){ ['json:number', n, {name: k}]},
22
+ NilClass: ->(x, k, n){ ['json:null', '', {name: k}]},
23
+ String: ->(x, k, s){ ['json:string', s, {name: k}]},
24
+ Array: ->(x, k, a){
25
+ ['json:array', '', {name: k},
26
+ *a.map{|y| p y; types[y.class.to_s.to_sym].call(x, k, y)}
27
+ ]
28
+ }
29
+ }
30
+
31
+ a = types[:Hash].call xml, '', h
32
+ @to_s Rexle.new(a).xml pretty: true
33
+ end
34
+
35
+ end
36
+
37
+ if __FILE__ == $0 then
38
+
39
+ JSONx.new(ARGV[0]).to_s
40
+
41
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jsonx
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
+ YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
+ 8ixkARkWAmV1MB4XDTE0MDkyNjA3MDkyNloXDTE1MDkyNjA3MDkyNlowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBAKeug5FQChXSDkY+iB42pX6ZAIFMfxcARGpyJfGh09dFF215jkyLFTgbJ1I6
19
+ lKwl9KZYhaXm5lTCgZKW6S2T7eIoSYRkh9tms7TeKiR0P33zVV/gCSoQJjFSanmS
20
+ O4ChIrMBFGlpGl110UwUMNwdLE7WZUdFRCC/RT2DH3ZRguoExnFeThqLxw5jZjRB
21
+ h71TTgOCxTGepjW3uIvSUMQ4HoX99W0qaOfYAmlFjVR1yhDhvW8ffy4kXdIPNqBZ
22
+ sE4WNCF6Sf6XL/wrHonZNNHEjkKqZRloAi01zQluLhG/Ghgwc90Xftpm0lbIS0AW
23
+ miLjG1TjXefr1jqeRy4mQ/o7GIcCAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQUnGu4zrPCwhBlTYxaKfOuiekjnBcwJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAYCeT+GCO
27
+ Y8BYS3uMWZsFR9GHoXFXdKmhIkW0Hr5PM3dbGFhmoLhtca+56lGaqMB8MxSkkLFN
28
+ /md/EisMJj0cH8HqgIGc767GQqLSThKy72sDW3+DpOrDMgrFsJiaS2Q5LL6y94ic
29
+ 3BD7X0HSxDk2qNCX4JEf2mrpTAC1F91m55qrcax5F4lLMEm2QN/tgl+zgO7WVtQT
30
+ b6DoVRpxpCXA8JHBz6SFHxnVu+xndhC4WBjoR93Mq0oHFBINatGkMcqwjW9dXJ0Y
31
+ oqIfSIJniA/rq0qM/Bhn+dpcKTcPQZtx+xFxMoZ25KJWupSNDOi8rtKUyPTNPrqu
32
+ 6j3yoPh2uEBjKA==
33
+ -----END CERTIFICATE-----
34
+ date: 2014-09-26 00:00:00.000000000 Z
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: rexle
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '1.0'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 1.0.23
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '1.0'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 1.0.23
56
+ description:
57
+ email: james@r0bertson.co.uk
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - lib/jsonx.rb
63
+ homepage: https://github.com/jrobertson/jsonx
64
+ licenses:
65
+ - MIT
66
+ metadata: {}
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubyforge_project:
83
+ rubygems_version: 2.2.2
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: Transforms JSON into JSONx
87
+ test_files: []
Binary file