lib/delorean/base.rb in delorean_lang-0.3.38 vs lib/delorean/base.rb in delorean_lang-0.4.00

- old
+ new

@@ -12,11 +12,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 = { - attributes: [ActiveRecord::Base], + # FIXME: hack -- Relation.attributes currently implemented in marty + attributes: [[ActiveRecord::Base, ActiveRecord::Relation]], between?: [NUM_OR_STR, NUM_OR_STR, NUM_OR_STR], between: "between?", compact: [[Array, Hash]], to_set: [Array], flatten: [Array, NUM_OR_NIL], @@ -149,13 +150,10 @@ case obj when nil # FIXME: even Javascript which is superpermissive raises an # exception on null getattr. return nil - when ActiveRecord::Base - return obj.read_attribute(attr) if obj.has_attribute?(attr) - return obj.send(attr.to_sym) if obj.class.reflections[attr] when NodeCall return obj.evaluate(attr) when OpenStruct return obj[attr.to_sym] when Class @@ -177,10 +175,10 @@ case obj when nil # FIXME: even Javascript which is superpermissive raises an # exception on null getattr. return nil - when Hash, ActiveRecord::Base, NodeCall, Class, OpenStruct + when Hash, NodeCall, Class, OpenStruct 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?(Integer) &&