bitswitch 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bitswitch.rb +6 -0
- data/lib/bitswitch/version.rb +1 -1
- metadata +1 -1
data/lib/bitswitch.rb
CHANGED
@@ -139,6 +139,9 @@ if defined? ActiveRecord::Base
|
|
139
139
|
KellyLSB::BitSwitch::LocalInstanceMethods.send(:define_method, column.to_sym) do |*args|
|
140
140
|
val = read_attribute(column)
|
141
141
|
|
142
|
+
# If nil make 0
|
143
|
+
val = 0 if val.nil?
|
144
|
+
|
142
145
|
# Make sure the value is an integer
|
143
146
|
raise KellyLSB::BitSwitch::Error, "Column: #{column} is not an integer!" unless val.is_a?(Fixnum)
|
144
147
|
|
@@ -156,6 +159,9 @@ if defined? ActiveRecord::Base
|
|
156
159
|
KellyLSB::BitSwitch::LocalInstanceMethods.send(:define_method, columne.to_sym) do |input|
|
157
160
|
val = read_attribute(column)
|
158
161
|
|
162
|
+
# If nil make 0
|
163
|
+
val = 0 if val.nil?
|
164
|
+
|
159
165
|
# Make sure the value is an integer
|
160
166
|
raise KellyLSB::BitSwitch::Error, "Column: #{column} is not an integer!" unless val.is_a?(Fixnum)
|
161
167
|
|
data/lib/bitswitch/version.rb
CHANGED