diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-27 14:44:06 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-27 14:44:06 -0700 |
commit | 9b5ca7a78f53da1ba1a817041e1c78ae673887a0 (patch) | |
tree | 5f3b682dd1afce40dbf4cea51464861091ff61e4 /lib/arel/engines/sql/formatters.rb | |
parent | c9d025261c14a1972bbad92796e1ba6adcc97d2b (diff) | |
download | rails-9b5ca7a78f53da1ba1a817041e1c78ae673887a0.tar.gz rails-9b5ca7a78f53da1ba1a817041e1c78ae673887a0.tar.bz2 rails-9b5ca7a78f53da1ba1a817041e1c78ae673887a0.zip |
PERF: avoiding more method missing
Diffstat (limited to 'lib/arel/engines/sql/formatters.rb')
-rw-r--r-- | lib/arel/engines/sql/formatters.rb | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/arel/engines/sql/formatters.rb b/lib/arel/engines/sql/formatters.rb index de8278479d..2597beba95 100644 --- a/lib/arel/engines/sql/formatters.rb +++ b/lib/arel/engines/sql/formatters.rb @@ -2,14 +2,31 @@ module Arel module Sql class Formatter attr_reader :environment, :christener - delegate :engine, :to => :environment - delegate :name_for, :to => :christener - delegate :quote_table_name, :quote_column_name, :quote, :to => :engine def initialize(environment) @environment = environment @christener = environment.christener end + + def name_for thing + @christener.name_for thing + end + + def engine + @environment.engine + end + + def quote_column_name name + engine.connection.quote_column_name name + end + + def quote_table_name name + engine.connection.quote_column_name name + end + + def quote value, column = nil + engine.connection.quote value, column + end end class SelectClause < Formatter |