tainbox 1.1.0 → 1.2.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: 1e918789c23fdf76d107321cefc24c818644c5a1
4
- data.tar.gz: f38d5d363ecd93f1215a92f9628f4e8c76845a48
3
+ metadata.gz: 39d0af0651b569f4cf39ab09ff548bed085d5f8e
4
+ data.tar.gz: 5e4489e525acb6aacf0e556a9aacc3d10b728ff7
5
5
  SHA512:
6
- metadata.gz: 55697c48d4e0f1eed0de539a8a1d7561855747bd0ed0fbafc0d86a9a22491120cf4e72f5abd5f77b8a875fc7684ee716ccd3534f20748a330551b422c644a01c
7
- data.tar.gz: 1b15674854681954ad2501be306b7e0af03d5e75d661a6dd8dbaed9295fa7fdb29f842d704457016aa90ed430e89e6fb6bcfd424bf3fdc336e6d5cf5155a7f5e
6
+ metadata.gz: 6b75710793915d64186e2ab032c01fa9565beb6d3f61c8dc51ceec0bb2be6226af41bea9dc8cb59d3ebb241462e07a87caaeee89c6262dc827facb93db7345dc
7
+ data.tar.gz: 8ee07e46b06606b418373d54d296514136ac8147d34ae264f6d6241a85165c5ac2af9628a06329b7750bf631522e61cf8f103245fa11c8c57e3836be16bafe9e
data/CHANGELOG.md CHANGED
@@ -37,3 +37,7 @@ avoid automatic casting from double star parameters
37
37
  ## 1.1.0
38
38
 
39
39
  * String converter supports `downcase` option to downcase values
40
+
41
+ ## 1.2.0
42
+
43
+ * Attributes can be assigned via any object which responds to `to_h`
@@ -21,8 +21,10 @@ module Tainbox::InstanceMethods
21
21
  end
22
22
 
23
23
  def attributes=(attributes)
24
- unless attributes.is_a?(Hash)
25
- raise ArgumentError, 'Attributes can only be assigned via a hash'
24
+ if attributes.respond_to?(:to_h)
25
+ attributes = attributes.to_h
26
+ else
27
+ raise ArgumentError, 'Attributes can only be assigned via objects which respond to #to_h'
26
28
  end
27
29
 
28
30
  attributes = attributes.symbolize_keys
@@ -1,3 +1,3 @@
1
1
  module Tainbox
2
- VERSION = '1.1.0'
2
+ VERSION = '1.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tainbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Gubitskiy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-23 00:00:00.000000000 Z
11
+ date: 2016-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport