lib/delorean/base.rb in delorean_lang-0.1.00 vs lib/delorean/base.rb in delorean_lang-0.1.01
- old
+ new
@@ -1,5 +1,7 @@
+require 'active_support/time'
+
module Delorean
# 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
@@ -92,11 +94,11 @@
if obj.instance_of?(Hash) || obj.kind_of?(ActiveRecord::Base) ||
obj.instance_of?(NodeCall) || obj.instance_of?(Class)
raise InvalidIndex unless args.length == 1
_get_attr(obj, args[0], _e)
elsif obj.instance_of?(Array)
- raise InvalidIndex unless args.length < 2
+ raise InvalidIndex unless args.length <= 2
raise InvalidIndex unless
args[0].is_a?(Fixnum) && (!args[1] || args[1].is_a?(Fixnum))
obj[*args]
else
raise InvalidIndex
@@ -130,10 +132,10 @@
sig = RUBY_WHITELIST[msg]
raise "no such method #{method}" unless sig
# if sig is a string, then method mapped to another name
- return _instance_call(obj, sig, args) if sig.respond_to?(:to_sym)
+ return _instance_call(obj, sig, args) if sig.is_a? String
raise "too many args to #{method}" if args.length>(sig.length-1)
arglist = [obj] + args