tainbox 2.1.1 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 245ea23761652bb1c160bfc33df82a51cf15845f
4
- data.tar.gz: 0eea24024053d344f9654790f28229bec64343c0
2
+ SHA256:
3
+ metadata.gz: ca89e9061cf00cc0c84a573af430fa595a28c816e6f991b98122dc4dbb2e0d5f
4
+ data.tar.gz: 28da1192a4c3252f60636bc4eabf011eedc9bf3b77e3f1b2c1f6d2e2a2033926
5
5
  SHA512:
6
- metadata.gz: 979d7fa9ca3395715056afd3203c487a7d73bdfc12d169edbc40d9db363be33301111ee144026f3b5902bbae34f1bdbc94500a0c070c304506911d9772c14c25
7
- data.tar.gz: 38c26110955e5f0f9330164107097640f21ecb7451fdea244af5035e13af2927121cec561aea759acf9b44443f7698d27cbb273a6bfd728e0fb22e79b5be761a
6
+ metadata.gz: 33452948dc55cd49cbfcc6e6c4b80891bda7a6b5a9e62b2bc1f374558006f0a22c7a372b655a00692966cbbd69a9fba45603509949e96718b74bdfd5de82515d
7
+ data.tar.gz: 1840b436afc88f26b986a39a994a40bb1b8e294075107683489a276e7cafb4e21f8b317292f92215e905e6e79c3cb9acdbb237c6d023671be7b8cf907c5b7f33
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2
4
+ - 2.3
5
+ - 2.4
6
+ - 2.5
7
+ - ruby-head
8
+ before_install:
9
+ - gem install bundler
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Tainbox
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/tainbox.svg)](https://badge.fury.io/rb/tainbox)
4
+ [![Build Status](https://travis-ci.org/enthrops/tainbox.svg?branch=master)](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!
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -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.each { |key, value| send("#{key}=", value) if respond_to?("#{key}=") }
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
@@ -1,3 +1,3 @@
1
1
  module Tainbox
2
- VERSION = '2.1.1'
2
+ VERSION = '2.1.2'
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: 2.1.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-01-24 00:00:00.000000000 Z
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.5.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