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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c3b95d42104a7a73d3af191aa0ab43a3aaadf03e6ab6bb612c07bd741a3cbd76
4
- data.tar.gz: 7b4ef3e1738d81605786d36a1be4dedb6d9233e4709a7ad189a0552ca0a6cb21
3
+ metadata.gz: d2850609edb1247c2c15d2b1b72b3d6f0c288201d1fb47ecc738d1c1987eeb48
4
+ data.tar.gz: d0910dc9c2ad1f9a0788eb0daa0d83efffeb5a17471516702583590bc3003efc
5
5
  SHA512:
6
- metadata.gz: bc0eb85df6dd1c2562b92d485f407bdf7a3a5ea3a0b2315a66d9a5a314ffe93a05d2772df1b149af4744cdcee4b6d2ace0c3eafb4aba573f757d67eed9ab9bdc
7
- data.tar.gz: ebbf2f57ee8c5f3b061d990478f7a1655dfe025e32e417c1cfce19f23373a6222a3d3cc23720e24bb51e7a8f3487bf29df90f69f357e216aab7662eaf592c766
6
+ metadata.gz: 0ff117b80d6c392b5235fc5758251221411749832c262c2dbf62e41940962bf326de09026fff3719daf15d779692b7b3b57df6425d0db090d18b6f00eace5108
7
+ data.tar.gz: f70010fc6fb6079569caf9c0c2a5f8f2ed952430e8d675bf48896a50ed68f5108d3b51810b3529962fc122a6d1bd9ac5a9a759ab99c94311eed5b7fdccab25cf
@@ -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**
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bumblebee (3.0.0)
4
+ bumblebee (3.0.1)
5
5
  acts_as_hashable (~> 1.0)
6
6
 
7
7
  GEM
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 #': { property: :id },
72
- 'First Name': { property: :name },
73
- 'Date of Birth': { property: :dob },
74
- 'Phone #': { property: :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
@@ -32,7 +32,7 @@ module Bumblebee
32
32
  end
33
33
 
34
34
  def column(header, opts = {})
35
- column = ::Bumblebee::Column.new(header, opts.symbolize_keys)
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.symbolize_keys)
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(h.is_a?(Hash) ? h[sub_property] : nil) }
21
+ Array(val).map { |h| per.convert(::Bumblebee::ObjectInterface.get(h, sub_property)) }
22
22
  .join(separator)
23
23
  end
24
24
 
@@ -8,5 +8,5 @@
8
8
  #
9
9
 
10
10
  module Bumblebee
11
- VERSION = '3.0.0'
11
+ VERSION = '3.0.1'
12
12
  end
@@ -1,8 +1,7 @@
1
1
  'ID #':
2
2
  property: id
3
3
  to_object: integer
4
- 'Plate #':
5
- property: plate
4
+ 'Plate #': plate
6
5
  Date:
7
6
  property: registration_date
8
7
  to_object: date
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.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-13 00:00:00.000000000 Z
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