tainbox 2.1.1 → 2.1.2
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 +5 -5
- data/.travis.yml +9 -0
- data/README.md +3 -0
- data/Rakefile +8 -0
- data/lib/tainbox/instance_methods.rb +2 -1
- data/lib/tainbox/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ca89e9061cf00cc0c84a573af430fa595a28c816e6f991b98122dc4dbb2e0d5f
|
4
|
+
data.tar.gz: 28da1192a4c3252f60636bc4eabf011eedc9bf3b77e3f1b2c1f6d2e2a2033926
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33452948dc55cd49cbfcc6e6c4b80891bda7a6b5a9e62b2bc1f374558006f0a22c7a372b655a00692966cbbd69a9fba45603509949e96718b74bdfd5de82515d
|
7
|
+
data.tar.gz: 1840b436afc88f26b986a39a994a40bb1b8e294075107683489a276e7cafb4e21f8b317292f92215e905e6e79c3cb9acdbb237c6d023671be7b8cf907c5b7f33
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Tainbox
|
2
2
|
|
3
|
+
[](https://badge.fury.io/rb/tainbox)
|
4
|
+
[](https://travis-ci.org/enthrops/tainbox)
|
5
|
+
|
3
6
|
Tainbox is a utility gem that can be used to inject attributes into Ruby objects. It is similar to <a href="https://github.com/solnic/virtus">Virtus</a>, but works a bit more sensibly (hopefully) and throws in some additional features.
|
4
7
|
|
5
8
|
## But we already have attr_accessor!
|
data/Rakefile
ADDED
@@ -47,7 +47,8 @@ module Tainbox::InstanceMethods
|
|
47
47
|
|
48
48
|
def patch_attributes(attributes)
|
49
49
|
if attributes.respond_to?(:to_h)
|
50
|
-
attributes.to_h.
|
50
|
+
attributes = attributes.to_h.symbolize_keys.slice(*self.class.tainbox_attributes)
|
51
|
+
attributes.each { |key, value| send("#{key}=", value) if respond_to?(key) }
|
51
52
|
else
|
52
53
|
raise ArgumentError, 'Attributes can only be assigned via objects which respond to #to_h'
|
53
54
|
end
|
data/lib/tainbox/version.rb
CHANGED
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: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Gubitskiy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -89,10 +89,12 @@ extra_rdoc_files: []
|
|
89
89
|
files:
|
90
90
|
- ".gitignore"
|
91
91
|
- ".rspec"
|
92
|
+
- ".travis.yml"
|
92
93
|
- CHANGELOG.md
|
93
94
|
- Gemfile
|
94
95
|
- LICENSE.txt
|
95
96
|
- README.md
|
97
|
+
- Rakefile
|
96
98
|
- bin/console
|
97
99
|
- lib/tainbox.rb
|
98
100
|
- lib/tainbox/attribute_definer.rb
|
@@ -123,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
125
|
version: '0'
|
124
126
|
requirements: []
|
125
127
|
rubyforge_project:
|
126
|
-
rubygems_version: 2.
|
128
|
+
rubygems_version: 2.7.3
|
127
129
|
signing_key:
|
128
130
|
specification_version: 4
|
129
131
|
summary: Tainbox is a utility gem that can be used to inject attributes into ruby
|