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 +4 -4
- data/README.md +1 -0
- data/lib/chop/create.rb +4 -0
- data/lib/chop/version.rb +1 -1
- 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: c484546204d204ee1867cc4448d301efedfb0923
|
4
|
+
data.tar.gz: 3bd7b433cd38da06a42ca42c91ae6114865a3896
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
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.
|
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-
|
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.
|
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!
|