bumblebee 3.0.0 → 3.0.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/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/README.md +5 -7
- data/lib/bumblebee/column_set.rb +8 -2
- data/lib/bumblebee/simple_converter.rb +1 -1
- data/lib/bumblebee/version.rb +1 -1
- data/spec/fixtures/registrations/columns.yml +1 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2850609edb1247c2c15d2b1b72b3d6f0c288201d1fb47ecc738d1c1987eeb48
|
4
|
+
data.tar.gz: d0910dc9c2ad1f9a0788eb0daa0d83efffeb5a17471516702583590bc3003efc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ff117b80d6c392b5235fc5758251221411749832c262c2dbf62e41940962bf326de09026fff3719daf15d779692b7b3b57df6425d0db090d18b6f00eace5108
|
7
|
+
data.tar.gz: f70010fc6fb6079569caf9c0c2a5f8f2ed952430e8d675bf48896a50ed68f5108d3b51810b3529962fc122a6d1bd9ac5a9a759ab99c94311eed5b7fdccab25cf
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# 3.0.1 (March 14th, 2019)
|
2
|
+
|
3
|
+
* Add support for the following column syntax: ```column 'ID #', :id```, ```column = { 'ID #' => :id }```. If the second argument is not a hash, it will be converted to: ```{ property: value }```
|
4
|
+
* pluck_join fix to correctly use ObjectInterface when extracting values.
|
5
|
+
|
1
6
|
# 3.0.0 (March 7th, 2019)
|
2
7
|
|
3
8
|
**Breaking Changes: Public API Re-Write**
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -68,10 +68,10 @@ Then we can explicitly map those as:
|
|
68
68
|
|
69
69
|
````ruby
|
70
70
|
columns = {
|
71
|
-
'ID #'
|
72
|
-
'First Name'
|
73
|
-
'Date of Birth'
|
74
|
-
'Phone #'
|
71
|
+
'ID #' => :id },
|
72
|
+
'First Name' => :name,
|
73
|
+
'Date of Birth' => :dob,
|
74
|
+
'Phone #' => :phone
|
75
75
|
}
|
76
76
|
````
|
77
77
|
|
@@ -114,9 +114,7 @@ Using the following column config:
|
|
114
114
|
|
115
115
|
````ruby
|
116
116
|
columns = {
|
117
|
-
'ID #':
|
118
|
-
property: :id
|
119
|
-
},
|
117
|
+
'ID #' => :id,
|
120
118
|
'First Name': {
|
121
119
|
property: :first,
|
122
120
|
through: :name
|
data/lib/bumblebee/column_set.rb
CHANGED
@@ -32,7 +32,7 @@ module Bumblebee
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def column(header, opts = {})
|
35
|
-
column = ::Bumblebee::Column.new(header, opts
|
35
|
+
column = ::Bumblebee::Column.new(header, normalize_opts(opts))
|
36
36
|
|
37
37
|
column_hash[column.header] = column
|
38
38
|
|
@@ -57,7 +57,7 @@ module Bumblebee
|
|
57
57
|
|
58
58
|
def add_header_column_hash(hash)
|
59
59
|
hash.each_pair do |header, opts|
|
60
|
-
column = ::Bumblebee::Column.new(header, opts
|
60
|
+
column = ::Bumblebee::Column.new(header, normalize_opts(opts))
|
61
61
|
|
62
62
|
assign(column)
|
63
63
|
end
|
@@ -79,5 +79,11 @@ module Bumblebee
|
|
79
79
|
# Base case, use arg as the header
|
80
80
|
column(arg)
|
81
81
|
end
|
82
|
+
|
83
|
+
# This is so we can support Header => Column Property direct assignment
|
84
|
+
# columns for simple object-to-csv directives
|
85
|
+
def normalize_opts(opts)
|
86
|
+
opts.is_a?(Hash) ? opts.symbolize_keys : { property: opts }
|
87
|
+
end
|
82
88
|
end
|
83
89
|
end
|
@@ -18,7 +18,7 @@ module Bumblebee
|
|
18
18
|
def process_pluck_join(val)
|
19
19
|
raise ArgumentError, 'sub_property is required for a pluck_join' unless sub_property
|
20
20
|
|
21
|
-
Array(val).map { |h| per.convert(
|
21
|
+
Array(val).map { |h| per.convert(::Bumblebee::ObjectInterface.get(h, sub_property)) }
|
22
22
|
.join(separator)
|
23
23
|
end
|
24
24
|
|
data/lib/bumblebee/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bumblebee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Ruggio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: acts_as_hashable
|