golden_fleece 0.1.5 → 1.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2204bb19d2ab9b43f0dc91d432cd5285b65fbf4b
4
- data.tar.gz: 0174ec6686b7ce519c373a66a19e77c4054f552c
3
+ metadata.gz: c130f83dfea54b7ffd401be7f9f0fefd6f52e7d8
4
+ data.tar.gz: 8271099f35ec36da61bfe27014602b82c4863592
5
5
  SHA512:
6
- metadata.gz: 2b0202c36875d51209114d97429997281ce501d9b477b3ba4cc67a1040522a4b5941834bd1b7837486559b0eb59ba6c50c9b6f83f4402f15bbb71c88acdf1ae0
7
- data.tar.gz: e950fc68a59c0954617ed4902e079d5b65637e86e88581f4e1e1f347c5628f24981a219724c2f972d77ef64d5bd8d6306f6789091138ed60707c495803b89a07
6
+ metadata.gz: 8f5936c48edc5452de563837594eea74004d7890dba1fceb63401d822aff1fb1d6511a7e37a3dc2df7930c2e7708761c9299af45593a0e32d957059a04fbd385
7
+ data.tar.gz: 8f887476dba5f63017588ee87ad18b892a57f97dbd85085cc8bc40e6f7cd7393fbf990b7c26d6b8a28f96bb112fe33822f530037afb91393b4e97642f5311e70
data/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
7
  ## [Unreleased]
8
+ ### [1.0.0] - 2017-06-15
9
+ ### Changed
10
+ - Consistently stringify all keys for `export_fleece` except for top-level column keys
11
+
8
12
  ### [0.1.5] - 2017-06-09
9
13
  ### Fixed
10
14
  - Subschema defaults no longer ignored in corner cases
@@ -40,7 +44,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
40
44
  - Getters
41
45
  - Specs
42
46
 
43
- [Unreleased]: https://github.com/earksiinni/golden_fleece/compare/v0.1.5...HEAD
47
+ [Unreleased]: https://github.com/earksiinni/golden_fleece/compare/v1.0.0...HEAD
48
+ [1.0.0]: https://github.com/earksiinni/golden_fleece/compare/v0.1.5...v1.0.0
44
49
  [0.1.5]: https://github.com/earksiinni/golden_fleece/compare/v0.1.4...v0.1.5
45
50
  [0.1.4]: https://github.com/earksiinni/golden_fleece/compare/v0.1.3...v0.1.4
46
51
  [0.1.3]: https://github.com/earksiinni/golden_fleece/compare/v0.1.2...v0.1.3
data/README.md CHANGED
@@ -38,7 +38,7 @@ end
38
38
  person.profile['first_name'] = 'Jane'
39
39
  person.profile['last_name'] = nil
40
40
  person.valid? # true
41
- person.export_fleece # { profile: { first_name: 'Jane', last_name: nil, zip_code: '90210' } }
41
+ person.export_fleece # { profile: { 'first_name' => 'Jane', 'last_name' => nil, 'zip_code' => '90210' } }
42
42
 
43
43
  person.profile.delete 'first_name'
44
44
  person.valid? # false
@@ -105,7 +105,7 @@ define_schemas :profile, {
105
105
 
106
106
  person.profile['zip_code'] = nil
107
107
  person.valid? # true
108
- person.export_fleece # { profile: { zip_code: '90210' } }
108
+ person.export_fleece # { profile: { 'zip_code' => '90210' } }
109
109
  person.profile['zip_code'] # nil
110
110
  ```
111
111
 
@@ -116,7 +116,7 @@ define_schemas :profile, {
116
116
  zip_code: { type: :string, default: -> record { record.closest_location.zip_code } }
117
117
  }
118
118
 
119
- person.export_fleece # { profile: { zip_code: '94131' } }
119
+ person.export_fleece # { profile: { 'zip_code' => '94131' } }
120
120
  ```
121
121
 
122
122
  ### Getters
@@ -7,7 +7,7 @@ module GoldenFleece
7
7
  schemas.reduce({}) { |memo, (attribute, schema)|
8
8
  if export_attributes.include? attribute
9
9
  memo[attribute] = schema.reduce({}) { |memo, (schema_name, schema)|
10
- memo[schema_name] = schema.value.compute(record)
10
+ memo[schema_name.to_s] = schema.value.compute(record)
11
11
  memo
12
12
  }
13
13
  end
@@ -26,12 +26,5 @@ module GoldenFleece
26
26
  memo
27
27
  }
28
28
  end
29
-
30
- def deep_symbolize_keys(hash)
31
- hash.reduce({}) { |memo, (key, value)|
32
- memo[key.to_sym] = value.is_a?(Hash) ? deep_symbolize_keys(value) : value
33
- memo
34
- }
35
- end
36
29
  end
37
30
  end
@@ -41,7 +41,7 @@ module GoldenFleece
41
41
  @value = if value.nil? || schema.parent?
42
42
  if schema.parent?
43
43
  d = schema.reduce({}) { |memo, (subschema_name, subschema)|
44
- memo[subschema_name] = subschema.value.compute(record)
44
+ memo[subschema_name.to_s] = subschema.value.compute(record)
45
45
  memo
46
46
  }
47
47
  d.values.compact.empty? ? nil : d
@@ -51,7 +51,7 @@ module GoldenFleece
51
51
  schema.default
52
52
  end
53
53
  else
54
- value.is_a?(Hash) ? deep_symbolize_keys(value) : value
54
+ value.is_a?(Hash) ? deep_stringify_keys(value) : value
55
55
  end
56
56
  end
57
57
  end
@@ -1,3 +1,3 @@
1
1
  module GoldenFleece
2
- VERSION = "0.1.5"
2
+ VERSION = "1.0.0"
3
3
  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.5
4
+ version: 1.0.0
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-06-09 00:00:00.000000000 Z
11
+ date: 2017-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler