xml2json-rb 0.3.1-x64-mingw-ucrt
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/xml2json/3.1/xml2json.so +0 -0
- data/lib/xml2json/3.2/xml2json.so +0 -0
- data/lib/xml2json/version.rb +5 -0
- data/lib/xml2json.rb +86 -0
- data/sig/xml2_json/json.rbs +6 -0
- data/sig/xml2_json/xml/encoding.rbs +7 -0
- data/sig/xml2_json/xml/version.rbs +8 -0
- data/sig/xml2_json/xml.rbs +6 -0
- data/sig/xml2json.rbs +4 -0
- metadata +214 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 046e2e1bd9d789f11af7925b813604bbdb8963f7f44b02c9514a62769dc87823
|
4
|
+
data.tar.gz: 24706ca0667c89c24f70c566c37be8fd1b3ff58d8fa8adff5e6a8314db140bef
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 71c9ae3be8dfc236a4c8128e693fe262b7db3a8a03d577d384d2693bddd6895c3dfc22cd9251c9653c8bc591924ef3322b23d4091549a2a019ffcdb4660571b8
|
7
|
+
data.tar.gz: 562cdadaeeccd553dcdb3264c64bb9118f4592ba963769c5bd2c50d96a6dbdec8895b1e5520a5bfb5435b1160b6fe91dbad53c865d0f37c44fb43602e39fc219
|
Binary file
|
Binary file
|
data/lib/xml2json.rb
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "xml2json/version"
|
4
|
+
begin
|
5
|
+
require_relative "xml2json/#{RUBY_VERSION[/(\d+\.\d+)/, 1]}/xml2json"
|
6
|
+
rescue LoadError
|
7
|
+
require_relative "xml2json/xml2json"
|
8
|
+
end
|
9
|
+
|
10
|
+
# @see https://docs.rs/xml2json-rs/1.0.1/xml2json_rs/index.html docs for the wrapped library
|
11
|
+
module Xml2Json
|
12
|
+
# @!parse [ruby]
|
13
|
+
# module Xml
|
14
|
+
# module Version
|
15
|
+
# XML10 = "1.0"
|
16
|
+
# XML11 = "1.1"
|
17
|
+
# end
|
18
|
+
# module Encoding
|
19
|
+
# UTF8 = "UTF-8"
|
20
|
+
# end
|
21
|
+
#
|
22
|
+
# # @param json_s [String, #to_str] JSON string
|
23
|
+
# # @param opts [Hash<Symbol, Object>] config params
|
24
|
+
# # @note Default values are provided by xml2json-rs
|
25
|
+
# # @see https://docs.rs/xml2json-rs/1.0.1/xml2json_rs/struct.XmlConfig.html Docs for xml2json-rs XmlConfig
|
26
|
+
# # @option opts [String, #to_str] root_name ("root") Root key name to contain produced JSON object
|
27
|
+
# # @option opts [String, #to_str] attrkey ("$") The value of the JSON key used to store XML attributes under
|
28
|
+
# # @option opts [String, #to_str] charkey ("_") The value of the JSON key used to store XML character data under
|
29
|
+
# # @option opts [nil, "1.0", "1.1", #to_s] version (Xml2Json::Version::XML10) XML Declaration 'version' field,
|
30
|
+
# # default if nil
|
31
|
+
# # @raise [RuntimeError] if +version.to_s+ returns unsupported string,
|
32
|
+
# # for now only +"1.0"+ and +"1.1"+ are supported
|
33
|
+
# # @option opts [nil, "UTF-8", #to_s] encoding (nil) XML Declaration 'encoding' field, empty if nil
|
34
|
+
# # @raise [RuntimeError] if +encoding.to_s+ returns unsupported string, for now only +"UTF-8"+ is supported
|
35
|
+
# # @option opts [bool, nil] standalone (nil) XML Declaration 'standalone' field, empty if nil
|
36
|
+
# # @option opts [bool] indent (false) Output XML with line-breaks and indentations
|
37
|
+
# # @option opts [String, #to_str] indent_char (" ") Character used for indentation. This option will be ignored
|
38
|
+
# # if +indent+ is false
|
39
|
+
# # @raise [TypeError] If +indent_char+ is more than one character or can not be encoded as UTF-8
|
40
|
+
# # @note It's not enough for the Ruby +indent_char+ string to be UTF-8 encoded, not sure
|
41
|
+
# # if that's a bug or a feature of Magnus
|
42
|
+
# # @option opts [Integer, #to_int] indent_size (2) Number of characters used for indentation.
|
43
|
+
# # This option will be ignored if +indent+ is false
|
44
|
+
# # @raise [RangeError] if +indent_size+ cannot be converted into +unsigned long long+
|
45
|
+
# # @return [String] XML string
|
46
|
+
# # @raise [RuntimeError] if +json_s+ is not valid JSON
|
47
|
+
# # @raise [TypeError] if +opts+ contain invalid value
|
48
|
+
# def self.build(json_s, opts: nil); end
|
49
|
+
# # @option opts [bool] indent (true)
|
50
|
+
# # @note Check +Xml2Json::Xml.build+ for other details, the only difference is that +indent+ is true by default
|
51
|
+
# # @see .build
|
52
|
+
# def self.build_pretty(json_s, opts: nil); end
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# module Json
|
56
|
+
# # @param xml [String, #to_str] XML string
|
57
|
+
# # @param opts [Hash<Symbol, Object>] config params
|
58
|
+
# # @note Default values are provided by xml2json-rs
|
59
|
+
# # @see https://docs.rs/xml2json-rs/1.0.1/xml2json_rs/struct.JsonConfig.html Docs for xml2json-rs JsonConfig
|
60
|
+
# # @option opts [String, #to_str] attrkey ("$") Key to outer object containing tag attributes
|
61
|
+
# # @option opts [String, #to_str] charkey ("_") Key to store character content under
|
62
|
+
# # @option opts [String, #to_str] empty_tag ("") The value of empty nodes
|
63
|
+
# # @option opts [bool] indent (false) Output JSON with line-breaks and indentations
|
64
|
+
# # @option opts [bool] explicit_root (true) Sets the root node inside the resulting object
|
65
|
+
# # @option opts [bool] trim (false) Trim whitespace at the beginning and end of text nodes
|
66
|
+
# # @option opts [bool] ignore_attrs (false) Setting this to true will skip adding element attributes
|
67
|
+
# # and create text nodes
|
68
|
+
# # @option opts [bool] merge_attrs (false) Merge all XML attributes and child elements as properties of
|
69
|
+
# # the parent, instead of keying attributes off of the child attribute object. This option will be
|
70
|
+
# # ignored if +ignore_attrs+ is true
|
71
|
+
# # @option opts [bool] normalize_text (false) Removes whitespace character data in text nodes
|
72
|
+
# # @option opts [bool] lowercase_tags (false) Normalize all tags by converting them to lowercase
|
73
|
+
# # @option opts [bool] explicit_array (true) Always put the child nodes in an array, otherwise an array is only
|
74
|
+
# # created if there is more than one child
|
75
|
+
# # @option opts [bool] explicit_charkey (false) Always store character data under +charkey+ even if there are
|
76
|
+
# # no other text elements stored inside the tag
|
77
|
+
# # @return [String] JSON string
|
78
|
+
# # @raise [RuntimeError] if +xml+ is not valid XML
|
79
|
+
# # @raise [TypeError] if +opts+ contain invalid value
|
80
|
+
# def self.build(xml, opts: nil); end
|
81
|
+
# # @option opts [bool] indent (true)
|
82
|
+
# # @note Check +Xml2Json::Json.build+ for other details, the only difference is that +indent+ is true by default
|
83
|
+
# # @see .build
|
84
|
+
# def self.build_pretty(xml, opts: nil); end
|
85
|
+
# end
|
86
|
+
end
|
data/sig/xml2json.rbs
ADDED
metadata
ADDED
@@ -0,0 +1,214 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: xml2json-rb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.1
|
5
|
+
platform: x64-mingw-ucrt
|
6
|
+
authors:
|
7
|
+
- uvlad7
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-10-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '13.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '13.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake-compiler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.21'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.21'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry-byebug
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: yard
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rack
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rackup
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: puma
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: toml-rb
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
description: This gem helps to convert xml strings to json and vise versa
|
168
|
+
email:
|
169
|
+
- uvlad7@gmail.com
|
170
|
+
executables: []
|
171
|
+
extensions: []
|
172
|
+
extra_rdoc_files: []
|
173
|
+
files:
|
174
|
+
- lib/xml2json.rb
|
175
|
+
- lib/xml2json/3.1/xml2json.so
|
176
|
+
- lib/xml2json/3.2/xml2json.so
|
177
|
+
- lib/xml2json/version.rb
|
178
|
+
- sig/xml2_json/json.rbs
|
179
|
+
- sig/xml2_json/xml.rbs
|
180
|
+
- sig/xml2_json/xml/encoding.rbs
|
181
|
+
- sig/xml2_json/xml/version.rbs
|
182
|
+
- sig/xml2json.rbs
|
183
|
+
homepage: https://github.com/uvlad7/xml2json-rb
|
184
|
+
licenses:
|
185
|
+
- MIT
|
186
|
+
metadata:
|
187
|
+
homepage_uri: https://github.com/uvlad7/xml2json-rb
|
188
|
+
source_code_uri: https://github.com/uvlad7/xml2json-rb
|
189
|
+
changelog_uri: https://github.com/uvlad7/xml2json-rb/blob/main/CHANGELOG.md
|
190
|
+
documentation_uri: https://rubydoc.info/gems/xml2json-rb/0.3.1
|
191
|
+
rubygems_mfa_required: 'true'
|
192
|
+
post_install_message:
|
193
|
+
rdoc_options: []
|
194
|
+
require_paths:
|
195
|
+
- lib
|
196
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - ">="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: '3.1'
|
201
|
+
- - "<"
|
202
|
+
- !ruby/object:Gem::Version
|
203
|
+
version: 3.3.dev
|
204
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ">="
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: 3.3.11
|
209
|
+
requirements: []
|
210
|
+
rubygems_version: 3.4.4
|
211
|
+
signing_key:
|
212
|
+
specification_version: 4
|
213
|
+
summary: Ruby wrapper for xml2json-rs
|
214
|
+
test_files: []
|