golden_fleece 0.1.0 → 0.1.1
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 +4 -4
- data/.gitignore +2 -0
- data/CHANGELOG.md +24 -0
- data/lib/golden_fleece/model/normalization.rb +6 -8
- data/lib/golden_fleece/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f996bbd5d3cba822166100ddbc5dce786e65b816
|
4
|
+
data.tar.gz: f35cf4bf3aa2e42e6570e802be2f643fe9304a92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c6fb47d237602b4f038de774bf5b5a596f1e73f9639d0892a4f49e60c1b5f33f2c4b9b42e52718ed952dd21f5ba0e88721a3c8ffd35775febea096cd44852c8
|
7
|
+
data.tar.gz: c677a968dc4a79037c4f5580787e23452d8fd53bee4c317986ec42515b0039abf989e5b4bafececf4419ff0b449740559c5424cec63cd0a618f424f1886be7c8
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Change Log
|
2
|
+
All notable changes to this project will be documented in this file.
|
3
|
+
|
4
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
5
|
+
and this project adheres to [Semantic Versioning](http://semver.org/).
|
6
|
+
|
7
|
+
## [Unreleased]
|
8
|
+
|
9
|
+
## [0.1.1] - 2017-05-25
|
10
|
+
### Fixed
|
11
|
+
- IMPORTANT: Fixed how normalization works when saving, no longer clobbers JSON
|
12
|
+
|
13
|
+
## 0.1.0 - 2017-05-25
|
14
|
+
### Added
|
15
|
+
- Initial commit
|
16
|
+
- Schemas
|
17
|
+
- Validation (types and formats)
|
18
|
+
- Normalization
|
19
|
+
- Exporting
|
20
|
+
- Getters
|
21
|
+
- Specs
|
22
|
+
|
23
|
+
[Unreleased]: https://github.com/earksiinni/golden_fleece/compare/v0.1.1...HEAD
|
24
|
+
[0.1.1]: https://github.com/earksiinni/golden_fleece/compare/ad25a847b5678b1f3a6c1c0b6a986d784142d38f...v0.1.1
|
@@ -6,15 +6,13 @@ module GoldenFleece
|
|
6
6
|
def normalize_fleece
|
7
7
|
self.class.fleece_context.schemas.each do |attribute, schema|
|
8
8
|
persisted_json = read_attribute attribute
|
9
|
+
computed_json = deep_stringify_keys schema.reduce({}) { |memo, (schema_name, schema)|
|
10
|
+
memo[schema_name] = schema.value.compute(self)
|
11
|
+
memo
|
12
|
+
}
|
9
13
|
|
10
|
-
|
11
|
-
|
12
|
-
computed_json = { schema_name => schema.value.compute(self) }
|
13
|
-
deep_stringify_keys computed_json if computed_json.is_a? Hash
|
14
|
-
|
15
|
-
if !persisted_json[schema_name].nil? && persisted_json[schema_name] != computed_json[schema_name]
|
16
|
-
write_attribute attribute, computed_json
|
17
|
-
end
|
14
|
+
if !persisted_json.nil? && persisted_json != computed_json
|
15
|
+
write_attribute attribute, computed_json
|
18
16
|
end
|
19
17
|
end
|
20
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: golden_fleece
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ersin Akinci
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -120,6 +120,7 @@ files:
|
|
120
120
|
- ".gitignore"
|
121
121
|
- ".rspec"
|
122
122
|
- ".travis.yml"
|
123
|
+
- CHANGELOG.md
|
123
124
|
- CODE_OF_CONDUCT.md
|
124
125
|
- Gemfile
|
125
126
|
- LICENSE.txt
|