store_as_int 0.0.14 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/store_as_int/base.rb +7 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6b72bc34f16042d91c14899ff1aedbdfbec14bc8e4c70f79d6e9511afccae28
|
4
|
+
data.tar.gz: 432f5f3458d0315d129e58c2c3f9f7d1794e8d2bf3b13238e4de36b53ff8195a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ea8dac641d4b63a2b14b97459f004a458b1e6df0e2607c29db5bba2a6daca31e15192bbf6c6ad941f072a3ad59ee709a0b84124e765f8de1c73af72fe22d896
|
7
|
+
data.tar.gz: f3cd3dd48ee061f9c6ad92947989d582a6b61bdb8d6aa63fd25b927732dfa1609d685045a21b50da2847be37404ce63951a13fd03affd03ea442a6aa7248d189
|
data/lib/store_as_int/base.rb
CHANGED
@@ -174,7 +174,11 @@ module StoreAsInt
|
|
174
174
|
|
175
175
|
def method_missing(name, *args, &blk)
|
176
176
|
if self.operators[name.to_sym]
|
177
|
-
|
177
|
+
if args[0].kind_of?(self.class)
|
178
|
+
convert(value.__send__ name, args[0].value, *args[1..-1])
|
179
|
+
else
|
180
|
+
convert(value.__send__(name, convert(args[0]), *args[1..-1]))
|
181
|
+
end
|
178
182
|
else
|
179
183
|
ret = value.send(name, *args, &blk)
|
180
184
|
ret.is_a?(Numeric) ? convert(ret) : ret
|
@@ -213,6 +217,7 @@ module StoreAsInt
|
|
213
217
|
decimal: to_d,
|
214
218
|
decimals: decimals,
|
215
219
|
float: to_f,
|
220
|
+
int: to_i,
|
216
221
|
str: to_s,
|
217
222
|
str_format: str_format,
|
218
223
|
str_matcher: matcher,
|
@@ -223,7 +228,7 @@ module StoreAsInt
|
|
223
228
|
end
|
224
229
|
|
225
230
|
def to_i
|
226
|
-
value
|
231
|
+
value.to_i
|
227
232
|
end
|
228
233
|
|
229
234
|
def to_json(*args)
|