delorean_lang 0.3.32 → 0.3.33

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2f8aaf5a3557bf3e76a8f95f52534d055569c39c
4
- data.tar.gz: 96660ba07840567867b368f423c49eca4268397d
3
+ metadata.gz: e6f8891a8771615853e2c27e6a990885dadb65f9
4
+ data.tar.gz: 7025ffd4e2f0ca45ed5f0f8c5cb7c966fb34eac8
5
5
  SHA512:
6
- metadata.gz: c69132b1cb303b515947de4902605a9a2844a5ecf4779e77d1d8c12bd3fa688a6c378297c4132fedcb335104f4a9b50c26a5b1323836d1c9ca0ea187148d192c
7
- data.tar.gz: 6bcad46448add879a392e473abd6b163864d3ff254ac566d1c819cfe3c4f6836d64655f790e88f4b1c9be0e2abde3c4a86525395b49d4674e7bcd6946b3b17da
6
+ metadata.gz: 78942629bdf7d297a2eda5e7ba808f0f88da8cdfb9d7bad0f03841fa17094e2d185218aaa748865771d06fc8383bf986a4697acd05df7f753da8cb8324f9df0e
7
+ data.tar.gz: ccb53908b8c1924f090ad263289057339847702b3111ab9f96b3facf02fc4bf6d21767d9d6101b4cf0f8734f7af1d29df7355f951b7ce6645211016d11abc1a3
data/Gemfile CHANGED
@@ -2,3 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in delorean.gemspec
4
4
  gemspec
5
+
6
+ group :development, :test do
7
+ gem 'rspec-instafail', require: false
8
+ end
@@ -6,7 +6,7 @@ module Delorean
6
6
 
7
7
  DT_TYPES = [Date, Time, ActiveSupport::TimeWithZone]
8
8
  NUM_OR_STR = [Numeric, String]
9
- NUM_OR_NIL = [nil, Fixnum]
9
+ NUM_OR_NIL = [nil, Integer]
10
10
 
11
11
  # FIXME: the whitelist is quite hacky. It's currently difficult to
12
12
  # override it. A user will likely want to directly modify this
@@ -27,8 +27,8 @@ module Delorean
27
27
  empty?: [Enumerable],
28
28
  except: [Hash, String] + [[nil, String]]*9,
29
29
  reverse: [Array],
30
- slice: [Array, Fixnum, Fixnum],
31
- each_slice: [Array, Fixnum],
30
+ slice: [Array, Integer, Integer],
31
+ each_slice: [Array, Integer],
32
32
  sort: [Array],
33
33
  split: [String, String],
34
34
  uniq: [Array],
@@ -45,6 +45,7 @@ module Delorean
45
45
 
46
46
  keys: [Hash],
47
47
  values: [Hash],
48
+ fetch: [Hash, Object, [Object]],
48
49
  upcase: [String],
49
50
  downcase: [String],
50
51
  match: [String, [String], NUM_OR_NIL],
@@ -179,8 +180,8 @@ module Delorean
179
180
  _get_attr(obj, args[0], _e)
180
181
  when Array, String, MatchData
181
182
  raise InvalidIndex unless args.length <= 2 &&
182
- args[0].is_a?(Fixnum) &&
183
- (args[1].nil? || args[1].is_a?(Fixnum))
183
+ args[0].is_a?(Integer) &&
184
+ (args[1].nil? || args[1].is_a?(Integer))
184
185
  obj[*args]
185
186
  else
186
187
  raise InvalidIndex
@@ -17,7 +17,7 @@ module Delorean
17
17
  raise "no signature" unless sig
18
18
 
19
19
  if sig
20
- sig = [sig, sig] if sig.is_a? Fixnum
20
+ sig = [sig, sig] if sig.is_a? Integer
21
21
  raise "Bad signature" unless (sig.is_a? Array and sig.length==2)
22
22
  self.const_set(name.to_s.upcase+Delorean::SIG, sig)
23
23
  end
@@ -1,3 +1,3 @@
1
1
  module Delorean
2
- VERSION = "0.3.32"
2
+ VERSION = "0.3.33"
3
3
  end
@@ -78,6 +78,18 @@ describe "Delorean" do
78
78
  r.should == ["hello", '12.3456', [1,2,3].to_s]
79
79
  end
80
80
 
81
+ it "should handle FETCH" do
82
+ engine.parse defn("A:",
83
+ " h = {'a':123, 1:111}",
84
+ " a = h.fetch('a')",
85
+ " b = h.fetch(1)",
86
+ " c = h.fetch('xxx', 456)",
87
+ )
88
+
89
+ r = engine.evaluate("A", ["a", "b", "c"])
90
+ r.should == [123, 111, 456]
91
+ end
92
+
81
93
  it "should handle TIMEPART" do
82
94
  engine.parse defn("A:",
83
95
  " p =?",
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.32
4
+ version: 0.3.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arman Bostani
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-25 00:00:00.000000000 Z
11
+ date: 2017-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: treetop