chop 0.18.0 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9437969c21a2222e26cbd07267a976fa19c58fac
4
- data.tar.gz: 84762ef6d1eca1f80a823e10e9c62e20cfeea707
3
+ metadata.gz: c484546204d204ee1867cc4448d301efedfb0923
4
+ data.tar.gz: 3bd7b433cd38da06a42ca42c91ae6114865a3896
5
5
  SHA512:
6
- metadata.gz: 5c37f4af27957e08a63433b72917e2258e0d8e64190d97e8ec30796eb804a5ca022e92ad56597dc746b603fb8e9aacb22d2155ca0e88ab7538429a5f5402e897
7
- data.tar.gz: 011669ab54baa0009368cf7db428d1a08122e99f72a909939bbcd0bb753760192307e4aff07a9b5877a9da889b3aff6a943fcb2670fc53eb74455043ddf63707
6
+ metadata.gz: e14e9b2b669905545cac242db1230a0dbda32a256b0cf1692c2233490ee4490e60353ca886c42d0200e06e59c1e332edadd9f73806f8422a13095af7207004bd
7
+ data.tar.gz: 72f1afb5833a62e983b7360e54e3a66e0174ff1f3c09ff402ccdf344e08f39ee16baf9f1438594267fbac9fe743f982a38425ca78e31953abac683c71da5ead7
data/README.md CHANGED
@@ -38,6 +38,7 @@ High-level declarative transformations:
38
38
  * `#has_one/#belongs_to`: Replaces an entity name with that entity. Uses `.find_by_name` by default.
39
39
  * `#has_many`: Replaces a comma-delimited list of entity names with an array of those entities. Uses `.find_by_name` by default.
40
40
  * `#underscore_keys`: Converts all hash keys to underscored versions.
41
+ * `#default`: Provides a default value for a given field.
41
42
  * `#rename`: Renames one or more fields.
42
43
  * `#delete`: Deletes one or more fields.
43
44
 
data/lib/chop/create.rb CHANGED
@@ -89,6 +89,10 @@ module Chop
89
89
  end
90
90
  end
91
91
 
92
+ def default key, default_value = nil
93
+ field(key, default: nil) { |value| value || default_value || yield }
94
+ end
95
+
92
96
  def underscore_keys
93
97
  transformation do |attributes|
94
98
  attributes.reduce(HashWithIndifferentAccess.new) do |hash, (key, value)|
data/lib/chop/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Chop
2
- VERSION = "0.18.0"
2
+ VERSION = "0.19.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-10 00:00:00.000000000 Z
11
+ date: 2017-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -155,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
155
  version: '0'
156
156
  requirements: []
157
157
  rubyforge_project:
158
- rubygems_version: 2.4.8
158
+ rubygems_version: 2.6.8
159
159
  signing_key:
160
160
  specification_version: 4
161
161
  summary: Slice and dice your cucumber tables with ease!