packed-model 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/packed_model/base.rb +2 -1
- data/packed-model.gemspec +1 -1
- data/spec/packed_model/base_spec.rb +7 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/lib/packed_model/base.rb
CHANGED
@@ -171,6 +171,7 @@ module PackedModel
|
|
171
171
|
|
172
172
|
fields.each_with_index do |fld, idx|
|
173
173
|
mask = 1 << idx
|
174
|
+
neg_mask = 0xFFFFFFFF ^ mask
|
174
175
|
|
175
176
|
define_method fld do
|
176
177
|
(self.send(name) & mask) == mask
|
@@ -180,7 +181,7 @@ module PackedModel
|
|
180
181
|
if val
|
181
182
|
self.send(name_equals, self.send(name) | mask)
|
182
183
|
else
|
183
|
-
self.send(name_equals, self.send(name)
|
184
|
+
self.send(name_equals, self.send(name) & neg_mask)
|
184
185
|
end
|
185
186
|
end
|
186
187
|
end
|
data/packed-model.gemspec
CHANGED
@@ -267,5 +267,12 @@ describe PackedModel::Base do
|
|
267
267
|
m.send("bit#{n}").should be_true
|
268
268
|
end
|
269
269
|
end
|
270
|
+
|
271
|
+
it "should not break on ||= false" do
|
272
|
+
m = TestBitVectorPackedModel.new
|
273
|
+
m.bit1.should be_false
|
274
|
+
m.bit1 ||= false
|
275
|
+
m.bit1.should be_false
|
276
|
+
end
|
270
277
|
end
|
271
278
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: packed-model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -83,7 +83,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
83
83
|
version: '0'
|
84
84
|
segments:
|
85
85
|
- 0
|
86
|
-
hash:
|
86
|
+
hash: 4377048112716490985
|
87
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
88
|
none: false
|
89
89
|
requirements:
|