lib/delorean/base.rb in delorean_lang-0.3.17 vs lib/delorean/base.rb in delorean_lang-0.3.19

- old
+ new

@@ -6,10 +6,12 @@ # 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. RUBY_WHITELIST = { + between?: [[Numeric, String],[Numeric, String],[Numeric, String]], + between: "between?", compact: [Array], to_set: [Array], flatten: [Array, [Fixnum, nil]], length: [Enumerable], max: [Array], @@ -225,10 +227,16 @@ if obj.is_a?(Class) _e[:_engine].parse_check_call_fn(method, args.count, obj) return obj.send(msg, *args) end - sig = RUBY_WHITELIST[msg] + sig = begin + obj.class.delorean_instance_methods[msg] + rescue NoMethodError + nil + end + + sig = RUBY_WHITELIST[msg] unless sig raise "no such method #{method}" unless sig # if sig is a string, then method mapped to another name return _instance_call(obj, sig, args, _e) if sig.is_a? String