diff options
author | Akira Matsuda <ronnie@dio.jp> | 2016-12-23 15:51:11 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2016-12-24 23:39:36 +0900 |
commit | 5b14129d8d4ad302b4e11df6bd5c7891b75f393c (patch) | |
tree | cfcd0a51846f540f40cc314e29a7070b415a9219 /activerecord/lib/active_record/connection_adapters/abstract_adapter.rb | |
parent | 6c5bbb4b7d3bdd1b43e512fb6ae764c373c7827b (diff) | |
download | rails-5b14129d8d4ad302b4e11df6bd5c7891b75f393c.tar.gz rails-5b14129d8d4ad302b4e11df6bd5c7891b75f393c.tar.bz2 rails-5b14129d8d4ad302b4e11df6bd5c7891b75f393c.zip |
Privatize unneededly protected methods in Active Record
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract_adapter.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_adapter.rb | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index 284529b46e..1badbb576d 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -499,9 +499,9 @@ module ActiveRecord result end - protected + private - def initialize_type_map(m) # :nodoc: + def initialize_type_map(m) register_class_with_limit m, %r(boolean)i, Type::Boolean register_class_with_limit m, %r(char)i, Type::String register_class_with_limit m, %r(binary)i, Type::Binary @@ -532,37 +532,37 @@ module ActiveRecord end end - def reload_type_map # :nodoc: + def reload_type_map type_map.clear initialize_type_map(type_map) end - def register_class_with_limit(mapping, key, klass) # :nodoc: + def register_class_with_limit(mapping, key, klass) mapping.register_type(key) do |*args| limit = extract_limit(args.last) klass.new(limit: limit) end end - def register_class_with_precision(mapping, key, klass) # :nodoc: + def register_class_with_precision(mapping, key, klass) mapping.register_type(key) do |*args| precision = extract_precision(args.last) klass.new(precision: precision) end end - def extract_scale(sql_type) # :nodoc: + def extract_scale(sql_type) case sql_type when /\((\d+)\)/ then 0 when /\((\d+)(,(\d+))\)/ then $3.to_i end end - def extract_precision(sql_type) # :nodoc: + def extract_precision(sql_type) $1.to_i if sql_type =~ /\((\d+)(,\d+)?\)/ end - def extract_limit(sql_type) # :nodoc: + def extract_limit(sql_type) case sql_type when /^bigint/i 8 @@ -571,7 +571,7 @@ module ActiveRecord end end - def translate_exception_class(e, sql) + def translate_exception_class(e, sql) # :doc: begin message = "#{e.class.name}: #{e.message}: #{sql}" rescue Encoding::CompatibilityError @@ -583,7 +583,7 @@ module ActiveRecord exception end - def log(sql, name = "SQL", binds = [], type_casted_binds = [], statement_name = nil) + def log(sql, name = "SQL", binds = [], type_casted_binds = [], statement_name = nil) # :doc: @instrumenter.instrument( "sql.active_record", sql: sql, @@ -596,7 +596,7 @@ module ActiveRecord raise translate_exception_class(e, sql) end - def translate_exception(exception, message) + def translate_exception(exception, message) # :doc: # override in derived class case exception when RuntimeError @@ -606,11 +606,11 @@ module ActiveRecord end end - def without_prepared_statement?(binds) + def without_prepared_statement?(binds) # :doc: !prepared_statements || binds.empty? end - def column_for(table_name, column_name) # :nodoc: + def column_for(table_name, column_name) column_name = column_name.to_s columns(table_name).detect { |c| c.name == column_name } || raise(ActiveRecordError, "No such column: #{table_name}.#{column_name}") |