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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d828ae6c2a90a7279b8bc50e7ea693bf5f528aeb
4
- data.tar.gz: e88e1188a4979f7e590d33bc56b360fec7ac2b87
3
+ metadata.gz: 3a5f702fe096b89e006bace5c2888cd8b633ba67
4
+ data.tar.gz: 575c2763efdc211da6ef0654b811fdc09365e0c1
5
5
  SHA512:
6
- metadata.gz: 5d1b9ed7b15d2e6cb2fe340dee440661845d75fe63c2de938aef0e90db488eb45cd72d68abbd5b47e0bd6fc4f20ec99af484ff8365ba5763cd87ec299fd447f6
7
- data.tar.gz: 20d16da4573467e11953252c0c5fafe530023d08a576b084a7c769e47b78b53c6b9717464d71c74f26b46ab99dd4a45a1123f591518a25303c03fdc5e3c2aee5
6
+ metadata.gz: 78d3b036ec732feba442288134e262ed937f3d9920c0ca69fdb965926ba819932fdcc0e7f0cf303016623f61164172a8cd5fd6a53d415afeca7c10034cf44705
7
+ data.tar.gz: 73e497c697afc9597e404801909e5ec8843b2decaa00e79bf4ac54b0aff49b80b479ec4c1c191bee0091a0d13748c93b21168d2017c3ef42cf2b13976f94f292
@@ -4,7 +4,8 @@ require 'bigdecimal'
4
4
 
5
5
  module Delorean
6
6
 
7
- DT_TYPES = [Date, Time, ActiveSupport::TimeWithZone]
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],
@@ -1,3 +1,3 @@
1
1
  module Delorean
2
- VERSION = "0.3.37"
2
+ VERSION = "0.3.38"
3
3
  end
@@ -65,15 +65,16 @@ describe "Delorean" do
65
65
  r.should == [12, 13]
66
66
  end
67
67
 
68
- it "should handle NUMBER" do
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.37
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-03-20 00:00:00.000000000 Z
11
+ date: 2018-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: treetop