From 93d72131bcc24ccb5536bec672d2dac94f8de651 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 24 Mar 2014 16:26:09 -0700 Subject: add the casting node to the AST at build time If we add the casting node to the ast at build time, then we can avoid doing the lookup at visit time. --- test/support/fake_record.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'test/support/fake_record.rb') diff --git a/test/support/fake_record.rb b/test/support/fake_record.rb index 58883e43cd..ed4420a2cd 100644 --- a/test/support/fake_record.rb +++ b/test/support/fake_record.rb @@ -66,6 +66,10 @@ module FakeRecord end case thing + when DateTime + "'#{thing.strftime("%Y-%m-%d %H:%M:%S")}'" + when Date + "'#{thing.strftime("%Y-%m-%d")}'" when true "'t'" when false @@ -75,7 +79,7 @@ module FakeRecord when Numeric thing else - "'#{thing}'" + "'#{thing.to_s.gsub("'", "\\\\'")}'" end end end -- cgit v1.2.3