bitfield_attribute 1.0.1 → 1.0.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
2
  SHA1:
3
- metadata.gz: e0f68aa834bb8f150a4bfcaa0534ad9b6693c004
4
- data.tar.gz: 0808aa68a9a40ab6255baa675883b64222adb4a9
3
+ metadata.gz: 16d14e29d866ba73a2257dd59db9cc754eb55984
4
+ data.tar.gz: 28097808e11d460e3a7de5091991ad3d3557fae8
5
5
  SHA512:
6
- metadata.gz: c8a40e0f86dc4f80a1cd04169c8ad7b178e84d3b8cd456afca7dde20db0629420d5b5887fce04837253a1b0ba01d8f218de3be68f7f3e90bf759cbcc92316171
7
- data.tar.gz: 31613ce6251d03270fd5d9a5c3829c99b29dc35cc70b3dfce9da1858f2c9ee0b60f9ec9c3d057af019e19aea83b80d7a4fe919f692f3d2e2fbb10701145ebe9d
6
+ metadata.gz: adc400cafe47bc7a842fa2095d2d546c81a6ae0b55998aa6f71f039173e7312a70e56934d93782a7024c7868704d55fca5b21c20384617660bb9bcfe2ffd20f9
7
+ data.tar.gz: c5bbb4a02c620ecc1de882900116398c6b60df49575fa6436e9cb7b47b29841e5cf3e738bb9b2790673df06aff8d5e2e040349f4bd5ccfed296e70a93242744f
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2
4
+ - 2.3
5
+ - 2.4
6
+ cache: bundler
data/README.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  Bitfield value object for ActiveModel. No hidden definitions. No callbacks. Magicless.
4
4
 
5
+ [![Build Status](https://travis-ci.org/gzigzigzeo/bitfield_attribute.svg)](http://travis-ci.org/gzigzigzeo/bitfield_attribute)
6
+
7
+ <a href="https://evilmartians.com/?utm_source=bitfield_attribute-gem">
8
+ <img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54">
9
+ </a>
10
+
5
11
  ## Installation
6
12
 
7
13
  Add this line to your application's Gemfile:
@@ -23,6 +23,6 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "rspec"
24
24
  spec.add_development_dependency "simplecov"
25
25
 
26
- spec.add_dependency "activemodel"
27
- spec.add_dependency "activerecord"
26
+ spec.add_dependency "activemodel", ">= 4.0", "< 5.1"
27
+ spec.add_dependency "activerecord", ">= 4.0", "< 5.1"
28
28
  end
@@ -85,7 +85,7 @@ module BitfieldAttribute
85
85
  end
86
86
 
87
87
  def update(value)
88
- if value.is_a?(Fixnum)
88
+ if value.is_a?(Integer)
89
89
  write_bits(value)
90
90
  else
91
91
  value.symbolize_keys.each do |key, value|
@@ -129,7 +129,13 @@ module BitfieldAttribute
129
129
  end
130
130
 
131
131
  def true_value?(value)
132
- value.in?(ActiveRecord::ConnectionAdapters::Column::TRUE_VALUES)
132
+ if ActiveRecord::VERSION::MAJOR == 5
133
+ ActiveRecord::Type::Boolean.new.cast(value)
134
+ elsif ActiveRecord::VERSION::MINOR < 2
135
+ ActiveRecord::ConnectionAdapters::Column.value_to_boolean(value)
136
+ else
137
+ ActiveRecord::Type::Boolean.new.type_cast_from_user(value)
138
+ end
133
139
  end
134
140
 
135
141
  INTEGER_SIZE = 32
@@ -1,3 +1,3 @@
1
1
  module BitfieldAttribute
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitfield_attribute
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Viktor Sokolov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-26 00:00:00.000000000 Z
11
+ date: 2017-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,28 +72,40 @@ dependencies:
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: '4.0'
76
+ - - "<"
77
+ - !ruby/object:Gem::Version
78
+ version: '5.1'
76
79
  type: :runtime
77
80
  prerelease: false
78
81
  version_requirements: !ruby/object:Gem::Requirement
79
82
  requirements:
80
83
  - - ">="
81
84
  - !ruby/object:Gem::Version
82
- version: '0'
85
+ version: '4.0'
86
+ - - "<"
87
+ - !ruby/object:Gem::Version
88
+ version: '5.1'
83
89
  - !ruby/object:Gem::Dependency
84
90
  name: activerecord
85
91
  requirement: !ruby/object:Gem::Requirement
86
92
  requirements:
87
93
  - - ">="
88
94
  - !ruby/object:Gem::Version
89
- version: '0'
95
+ version: '4.0'
96
+ - - "<"
97
+ - !ruby/object:Gem::Version
98
+ version: '5.1'
90
99
  type: :runtime
91
100
  prerelease: false
92
101
  version_requirements: !ruby/object:Gem::Requirement
93
102
  requirements:
94
103
  - - ">="
95
104
  - !ruby/object:Gem::Version
96
- version: '0'
105
+ version: '4.0'
106
+ - - "<"
107
+ - !ruby/object:Gem::Version
108
+ version: '5.1'
97
109
  description: Bitfield value object for ActiveModel. No hidden definitions. No callbacks.
98
110
  Magicless.
99
111
  email:
@@ -103,6 +115,7 @@ extensions: []
103
115
  extra_rdoc_files: []
104
116
  files:
105
117
  - ".gitignore"
118
+ - ".travis.yml"
106
119
  - Gemfile
107
120
  - LICENSE.txt
108
121
  - README.md
@@ -135,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
148
  version: '0'
136
149
  requirements: []
137
150
  rubyforge_project:
138
- rubygems_version: 2.4.6
151
+ rubygems_version: 2.6.12
139
152
  signing_key:
140
153
  specification_version: 4
141
154
  summary: Bitfield value object for ActiveModel