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 +4 -4
- data/.travis.yml +6 -0
- data/README.md +6 -0
- data/bitfield_attribute.gemspec +2 -2
- data/lib/bitfield_attribute/base.rb +8 -2
- data/lib/bitfield_attribute/version.rb +1 -1
- metadata +20 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16d14e29d866ba73a2257dd59db9cc754eb55984
|
4
|
+
data.tar.gz: 28097808e11d460e3a7de5091991ad3d3557fae8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adc400cafe47bc7a842fa2095d2d546c81a6ae0b55998aa6f71f039173e7312a70e56934d93782a7024c7868704d55fca5b21c20384617660bb9bcfe2ffd20f9
|
7
|
+
data.tar.gz: c5bbb4a02c620ecc1de882900116398c6b60df49575fa6436e9cb7b47b29841e5cf3e738bb9b2790673df06aff8d5e2e040349f4bd5ccfed296e70a93242744f
|
data/.travis.yml
ADDED
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:
|
data/bitfield_attribute.gemspec
CHANGED
@@ -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?(
|
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
|
-
|
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
|
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.
|
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:
|
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.
|
151
|
+
rubygems_version: 2.6.12
|
139
152
|
signing_key:
|
140
153
|
specification_version: 4
|
141
154
|
summary: Bitfield value object for ActiveModel
|