xml-mapping_extensions 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -9
- data/CHANGES.md +6 -0
- data/example.rb +1 -3
- data/lib/xml/mapping_extensions/enum_node_base.rb +7 -1
- data/lib/xml/mapping_extensions/version.rb +1 -1
- data/spec/unit/xml/mapping_extensions/enum_node_base_spec.rb +7 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6974aa25a580ab47d6ffc41468fe2afb54c6ad91
|
4
|
+
data.tar.gz: 4fd09884318b53fdbdf1f3de954fbe87677e867a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54d02c4c2bbae8388b21956cdc68f7183e100c321c3eb38ae3c54c597308fe6969d20e296aac0375eea25a886565e120eec9b815c72cfa1ad1ca4e5c7f27329d
|
7
|
+
data.tar.gz: bb25f1d1b4de7cdf86d8110a2b1264f4b8f31fa83058418a4c3743ff7499160764c7377dd47222a76f754a6c8131d3dfad249bd0f6ab921ccfad50db35e0f5ec
|
data/.gitignore
CHANGED
@@ -15,15 +15,9 @@
|
|
15
15
|
*.a
|
16
16
|
mkmf.log
|
17
17
|
|
18
|
-
#
|
18
|
+
# Gem
|
19
19
|
|
20
|
-
|
21
|
-
log/*.log
|
22
|
-
spec/dummy/db/*.sqlite3
|
23
|
-
spec/dummy/db/*.sqlite3-journal
|
24
|
-
spec/dummy/log/*.log
|
25
|
-
spec/dummy/tmp/
|
26
|
-
spec/dummy/.sass-cache
|
20
|
+
xml-mapping_extensions*gem
|
27
21
|
|
28
22
|
# IntellJ
|
29
23
|
|
@@ -39,4 +33,4 @@ spec/dummy/.sass-cache
|
|
39
33
|
|
40
34
|
# Mac OS
|
41
35
|
|
42
|
-
.DS_Store
|
36
|
+
.DS_Store
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 0.2.0 (16 November 2015)
|
2
|
+
|
3
|
+
- Fixed `EnumNodeBase` to correctly parse string values as enum instances,
|
4
|
+
and to correctly map enum instances to string values.
|
5
|
+
(See [ruby-enum issue #6](https://github.com/dblock/ruby-enum/issues/6).)
|
6
|
+
|
1
7
|
## 0.1.1 (24 September 2015)
|
2
8
|
|
3
9
|
- Added support for UTC "Zulu" time designator to `DateNode`
|
data/example.rb
CHANGED
@@ -16,7 +16,13 @@ module XML
|
|
16
16
|
|
17
17
|
def to_value(xml_text)
|
18
18
|
enum_class = self.class::ENUM_CLASS
|
19
|
-
enum_class.
|
19
|
+
enum_class.map do |_, enum|
|
20
|
+
return enum if enum.value == xml_text
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_xml_text(value)
|
25
|
+
value.value
|
20
26
|
end
|
21
27
|
|
22
28
|
end
|
@@ -8,6 +8,7 @@ module XML
|
|
8
8
|
|
9
9
|
define :FOO, 'foo'
|
10
10
|
define :BAR, 'bar'
|
11
|
+
define :BAZ_QUX, 'baz_qux'
|
11
12
|
end
|
12
13
|
|
13
14
|
class MyEnumNode < EnumNodeBase
|
@@ -39,11 +40,15 @@ module XML
|
|
39
40
|
end
|
40
41
|
|
41
42
|
it 'parses an enum value' do
|
42
|
-
|
43
|
+
MyEnum.map do |_, enum|
|
44
|
+
expect(to_my_enum(enum.value)).to eq(enum)
|
45
|
+
end
|
43
46
|
end
|
44
47
|
|
45
48
|
it 'transforms an enum to a string' do
|
46
|
-
|
49
|
+
MyEnum.map do |_, enum|
|
50
|
+
expect(to_text(enum)).to eq(enum.value)
|
51
|
+
end
|
47
52
|
end
|
48
53
|
|
49
54
|
it 'parses a missing value as nil' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xml-mapping_extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Moles
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mime-types
|
@@ -204,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
204
204
|
version: '0'
|
205
205
|
requirements: []
|
206
206
|
rubyforge_project:
|
207
|
-
rubygems_version: 2.4.
|
207
|
+
rubygems_version: 2.4.6
|
208
208
|
signing_key:
|
209
209
|
specification_version: 4
|
210
210
|
summary: Some extensions for for XML::Mapping
|