shale 0.2.1 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -0
- data/README.md +274 -7
- data/exe/shaleb +75 -0
- data/lib/shale/adapter/json.rb +7 -2
- data/lib/shale/adapter/nokogiri.rb +48 -12
- data/lib/shale/adapter/ox.rb +28 -4
- data/lib/shale/adapter/rexml.rb +56 -13
- data/lib/shale/attribute.rb +1 -1
- data/lib/shale/error.rb +6 -0
- data/lib/shale/mapper.rb +11 -11
- data/lib/shale/mapping/descriptor/dict.rb +57 -0
- data/lib/shale/mapping/descriptor/xml.rb +43 -0
- data/lib/shale/mapping/descriptor/xml_namespace.rb +37 -0
- data/lib/shale/mapping/{key_value.rb → dict.rb} +8 -6
- data/lib/shale/mapping/validator.rb +51 -0
- data/lib/shale/mapping/xml.rb +86 -15
- data/lib/shale/schema/json/base.rb +41 -0
- data/lib/shale/schema/json/boolean.rb +23 -0
- data/lib/shale/schema/json/collection.rb +39 -0
- data/lib/shale/schema/json/date.rb +23 -0
- data/lib/shale/schema/json/float.rb +23 -0
- data/lib/shale/schema/json/integer.rb +23 -0
- data/lib/shale/schema/json/object.rb +37 -0
- data/lib/shale/schema/json/ref.rb +28 -0
- data/lib/shale/schema/json/schema.rb +57 -0
- data/lib/shale/schema/json/string.rb +23 -0
- data/lib/shale/schema/json/time.rb +23 -0
- data/lib/shale/schema/json.rb +165 -0
- data/lib/shale/schema/xml/attribute.rb +41 -0
- data/lib/shale/schema/xml/complex_type.rb +67 -0
- data/lib/shale/schema/xml/element.rb +55 -0
- data/lib/shale/schema/xml/import.rb +46 -0
- data/lib/shale/schema/xml/ref_attribute.rb +37 -0
- data/lib/shale/schema/xml/ref_element.rb +39 -0
- data/lib/shale/schema/xml/schema.rb +121 -0
- data/lib/shale/schema/xml/typed_attribute.rb +46 -0
- data/lib/shale/schema/xml/typed_element.rb +46 -0
- data/lib/shale/schema/xml.rb +316 -0
- data/lib/shale/schema.rb +47 -0
- data/lib/shale/type/boolean.rb +2 -2
- data/lib/shale/type/composite.rb +67 -56
- data/lib/shale/type/date.rb +35 -2
- data/lib/shale/type/float.rb +2 -2
- data/lib/shale/type/integer.rb +2 -2
- data/lib/shale/type/string.rb +2 -2
- data/lib/shale/type/time.rb +35 -2
- data/lib/shale/type/{base.rb → value.rb} +18 -7
- data/lib/shale/utils.rb +18 -2
- data/lib/shale/version.rb +1 -1
- data/lib/shale.rb +10 -10
- data/shale.gemspec +6 -2
- metadata +41 -13
- data/lib/shale/mapping/base.rb +0 -32
metadata
CHANGED
@@ -1,25 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shale
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kamil Giszczak
|
8
|
-
autorequire:
|
9
|
-
bindir:
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby object mapper and serializer for XML, JSON and YAML.
|
14
14
|
email:
|
15
15
|
- beerkg@gmail.com
|
16
|
-
executables:
|
16
|
+
executables:
|
17
|
+
- shaleb
|
17
18
|
extensions: []
|
18
19
|
extra_rdoc_files: []
|
19
20
|
files:
|
20
21
|
- CHANGELOG.md
|
21
22
|
- LICENSE.txt
|
22
23
|
- README.md
|
24
|
+
- exe/shaleb
|
23
25
|
- lib/shale.rb
|
24
26
|
- lib/shale/adapter/json.rb
|
25
27
|
- lib/shale/adapter/nokogiri.rb
|
@@ -28,10 +30,35 @@ files:
|
|
28
30
|
- lib/shale/attribute.rb
|
29
31
|
- lib/shale/error.rb
|
30
32
|
- lib/shale/mapper.rb
|
31
|
-
- lib/shale/mapping/
|
32
|
-
- lib/shale/mapping/
|
33
|
+
- lib/shale/mapping/descriptor/dict.rb
|
34
|
+
- lib/shale/mapping/descriptor/xml.rb
|
35
|
+
- lib/shale/mapping/descriptor/xml_namespace.rb
|
36
|
+
- lib/shale/mapping/dict.rb
|
37
|
+
- lib/shale/mapping/validator.rb
|
33
38
|
- lib/shale/mapping/xml.rb
|
34
|
-
- lib/shale/
|
39
|
+
- lib/shale/schema.rb
|
40
|
+
- lib/shale/schema/json.rb
|
41
|
+
- lib/shale/schema/json/base.rb
|
42
|
+
- lib/shale/schema/json/boolean.rb
|
43
|
+
- lib/shale/schema/json/collection.rb
|
44
|
+
- lib/shale/schema/json/date.rb
|
45
|
+
- lib/shale/schema/json/float.rb
|
46
|
+
- lib/shale/schema/json/integer.rb
|
47
|
+
- lib/shale/schema/json/object.rb
|
48
|
+
- lib/shale/schema/json/ref.rb
|
49
|
+
- lib/shale/schema/json/schema.rb
|
50
|
+
- lib/shale/schema/json/string.rb
|
51
|
+
- lib/shale/schema/json/time.rb
|
52
|
+
- lib/shale/schema/xml.rb
|
53
|
+
- lib/shale/schema/xml/attribute.rb
|
54
|
+
- lib/shale/schema/xml/complex_type.rb
|
55
|
+
- lib/shale/schema/xml/element.rb
|
56
|
+
- lib/shale/schema/xml/import.rb
|
57
|
+
- lib/shale/schema/xml/ref_attribute.rb
|
58
|
+
- lib/shale/schema/xml/ref_element.rb
|
59
|
+
- lib/shale/schema/xml/schema.rb
|
60
|
+
- lib/shale/schema/xml/typed_attribute.rb
|
61
|
+
- lib/shale/schema/xml/typed_element.rb
|
35
62
|
- lib/shale/type/boolean.rb
|
36
63
|
- lib/shale/type/composite.rb
|
37
64
|
- lib/shale/type/date.rb
|
@@ -39,19 +66,20 @@ files:
|
|
39
66
|
- lib/shale/type/integer.rb
|
40
67
|
- lib/shale/type/string.rb
|
41
68
|
- lib/shale/type/time.rb
|
69
|
+
- lib/shale/type/value.rb
|
42
70
|
- lib/shale/utils.rb
|
43
71
|
- lib/shale/version.rb
|
44
72
|
- shale.gemspec
|
45
|
-
homepage: https://
|
73
|
+
homepage: https://shalerb.org
|
46
74
|
licenses:
|
47
75
|
- MIT
|
48
76
|
metadata:
|
49
77
|
allowed_push_host: https://rubygems.org
|
50
|
-
homepage_uri: https://
|
78
|
+
homepage_uri: https://shalerb.org
|
51
79
|
source_code_uri: https://github.com/kgiszczak/shale
|
52
80
|
changelog_uri: https://github.com/kgiszczak/shale/blob/master/CHANGELOG.md
|
53
81
|
bug_tracker_uri: https://github.com/kgiszczak/shale/issues
|
54
|
-
post_install_message:
|
82
|
+
post_install_message:
|
55
83
|
rdoc_options: []
|
56
84
|
require_paths:
|
57
85
|
- lib
|
@@ -66,8 +94,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
94
|
- !ruby/object:Gem::Version
|
67
95
|
version: '0'
|
68
96
|
requirements: []
|
69
|
-
rubygems_version: 3.1.
|
70
|
-
signing_key:
|
97
|
+
rubygems_version: 3.1.6
|
98
|
+
signing_key:
|
71
99
|
specification_version: 4
|
72
100
|
summary: Ruby object mapper and serializer for XML, JSON and YAML.
|
73
101
|
test_files: []
|
data/lib/shale/mapping/base.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative '../error'
|
4
|
-
|
5
|
-
module Shale
|
6
|
-
module Mapping
|
7
|
-
class Base
|
8
|
-
private
|
9
|
-
|
10
|
-
# Validate correctness of argument passed to map functions
|
11
|
-
#
|
12
|
-
# @param [String] key
|
13
|
-
# @param [Symbol] to
|
14
|
-
# @param [Hash] using
|
15
|
-
#
|
16
|
-
# @raise [IncorrectMappingArgumentsError] when arguments are incorrect
|
17
|
-
#
|
18
|
-
# @api private
|
19
|
-
def validate_arguments(key, to, using)
|
20
|
-
if to.nil? && using.nil?
|
21
|
-
msg = ":to or :using argument is required for mapping '#{key}'"
|
22
|
-
raise IncorrectMappingArgumentsError, msg
|
23
|
-
end
|
24
|
-
|
25
|
-
if !using.nil? && (using[:from].nil? || using[:to].nil?)
|
26
|
-
msg = ":using argument for mapping '#{key}' requires :to and :from keys"
|
27
|
-
raise IncorrectMappingArgumentsError, msg
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|