delorean_lang 0.3.37 → 0.3.38
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/delorean/base.rb +4 -3
- data/lib/delorean/version.rb +1 -1
- data/spec/func_spec.rb +4 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a5f702fe096b89e006bace5c2888cd8b633ba67
|
4
|
+
data.tar.gz: 575c2763efdc211da6ef0654b811fdc09365e0c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78d3b036ec732feba442288134e262ed937f3d9920c0ca69fdb965926ba819932fdcc0e7f0cf303016623f61164172a8cd5fd6a53d415afeca7c10034cf44705
|
7
|
+
data.tar.gz: 73e497c697afc9597e404801909e5ec8843b2decaa00e79bf4ac54b0aff49b80b479ec4c1c191bee0091a0d13748c93b21168d2017c3ef42cf2b13976f94f292
|
data/lib/delorean/base.rb
CHANGED
@@ -4,7 +4,8 @@ require 'bigdecimal'
|
|
4
4
|
|
5
5
|
module Delorean
|
6
6
|
|
7
|
-
|
7
|
+
TI_TYPES = [Time, ActiveSupport::TimeWithZone]
|
8
|
+
DT_TYPES = [Date] + TI_TYPES
|
8
9
|
NUM_OR_STR = [Numeric, String]
|
9
10
|
NUM_OR_NIL = [nil, Integer]
|
10
11
|
|
@@ -70,8 +71,8 @@ module Delorean
|
|
70
71
|
next_day: [DT_TYPES, NUM_OR_NIL],
|
71
72
|
prev_day: [DT_TYPES, NUM_OR_NIL],
|
72
73
|
|
73
|
-
to_i: [NUM_OR_STR],
|
74
|
-
to_f: [NUM_OR_STR],
|
74
|
+
to_i: [NUM_OR_STR + TI_TYPES],
|
75
|
+
to_f: [NUM_OR_STR + TI_TYPES],
|
75
76
|
to_d: [NUM_OR_STR],
|
76
77
|
to_s: [Object],
|
77
78
|
to_a: [Object],
|
data/lib/delorean/version.rb
CHANGED
data/spec/func_spec.rb
CHANGED
@@ -65,15 +65,16 @@ describe "Delorean" do
|
|
65
65
|
r.should == [12, 13]
|
66
66
|
end
|
67
67
|
|
68
|
-
it "should handle
|
68
|
+
it "should handle TO_F" do
|
69
69
|
engine.parse defn("A:",
|
70
70
|
" a = 12.3456.to_f()",
|
71
71
|
" b = '12.3456'.to_f()",
|
72
72
|
" c = '12'.to_f()",
|
73
|
+
" d = '2018-05-04 10:56:27 -0700'.to_time.to_f",
|
73
74
|
)
|
74
75
|
|
75
|
-
r = engine.evaluate("A", ["a", "b", "c"])
|
76
|
-
r.should == [12.3456, 12.3456, 12]
|
76
|
+
r = engine.evaluate("A", ["a", "b", "c", "d"])
|
77
|
+
r.should == [12.3456, 12.3456, 12, 1525456587.0]
|
77
78
|
end
|
78
79
|
|
79
80
|
it "should handle ABS" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: delorean_lang
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.38
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arman Bostani
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: treetop
|