lib/delorean/base.rb in delorean_lang-0.3.32 vs lib/delorean/base.rb in delorean_lang-0.3.33

- old
+ new

@@ -4,11 +4,11 @@ module Delorean DT_TYPES = [Date, Time, ActiveSupport::TimeWithZone] NUM_OR_STR = [Numeric, String] - NUM_OR_NIL = [nil, Fixnum] + NUM_OR_NIL = [nil, Integer] # FIXME: the whitelist is quite hacky. It's currently difficult to # override it. A user will likely want to directly modify this # hash. The whole whitelist mechanism should be eventually # rethought. @@ -25,12 +25,12 @@ member?: [Enumerable, [Object]], empty: "empty?", empty?: [Enumerable], except: [Hash, String] + [[nil, String]]*9, reverse: [Array], - slice: [Array, Fixnum, Fixnum], - each_slice: [Array, Fixnum], + slice: [Array, Integer, Integer], + each_slice: [Array, Integer], sort: [Array], split: [String, String], uniq: [Array], sum: [Array], transpose: [Array], @@ -43,10 +43,11 @@ intersection: [Set, Enumerable], union: [Set, Enumerable], keys: [Hash], values: [Hash], + fetch: [Hash, Object, [Object]], upcase: [String], downcase: [String], match: [String, [String], NUM_OR_NIL], iso8601: [DT_TYPES], @@ -177,11 +178,11 @@ when Hash, ActiveRecord::Base, NodeCall, Class raise InvalidIndex unless args.length == 1 _get_attr(obj, args[0], _e) when Array, String, MatchData raise InvalidIndex unless args.length <= 2 && - args[0].is_a?(Fixnum) && - (args[1].nil? || args[1].is_a?(Fixnum)) + args[0].is_a?(Integer) && + (args[1].nil? || args[1].is_a?(Integer)) obj[*args] else raise InvalidIndex end end