No need to nodoc private methods

This commit is contained in:
Akira Matsuda 2016-12-24 22:39:19 +09:00
parent 4273ab34c4
commit 6c5bbb4b7d
11 changed files with 31 additions and 31 deletions

@ -15,11 +15,11 @@ def reload(*) # :nodoc:
private
def clear_aggregation_cache # :nodoc:
def clear_aggregation_cache
@aggregation_cache.clear if persisted?
end
def init_internals # :nodoc:
def init_internals
@aggregation_cache = {}
super
end

@ -260,11 +260,11 @@ def reload(*) # :nodoc:
private
# Clears out the association cache.
def clear_association_cache # :nodoc:
def clear_association_cache
@association_cache.clear if persisted?
end
def init_internals # :nodoc:
def init_internals
@association_cache = {}
super
end

@ -12,7 +12,7 @@ def attributes=(attributes)
private
def _assign_attributes(attributes) # :nodoc:
def _assign_attributes(attributes)
multi_parameter_attributes = {}
nested_parameter_attributes = {}

@ -283,15 +283,15 @@ def touch(*) #:nodoc:
private
def create_or_update(*) #:nodoc:
def create_or_update(*)
_run_save_callbacks { super }
end
def _create_record #:nodoc:
def _create_record
_run_create_callbacks { super }
end
def _update_record(*) #:nodoc:
def _update_record(*)
_run_update_callbacks { super }
end
end

@ -1262,7 +1262,7 @@ def create_alter_table(name)
AlterTable.new create_table_definition(name)
end
def index_name_options(column_names) # :nodoc:
def index_name_options(column_names)
if column_names.is_a?(String)
column_names = column_names.scan(/\w+/).join("_")
end
@ -1270,7 +1270,7 @@ def index_name_options(column_names) # :nodoc:
{ column: column_names }
end
def foreign_key_name(table_name, options) # :nodoc:
def foreign_key_name(table_name, options)
identifier = "#{table_name}_#{options.fetch(:column)}_fk"
hashed_identifier = Digest::SHA256.hexdigest(identifier).first(10)
options.fetch(:name) do
@ -1278,7 +1278,7 @@ def foreign_key_name(table_name, options) # :nodoc:
end
end
def validate_index_length!(table_name, new_name, internal = false) # :nodoc:
def validate_index_length!(table_name, new_name, internal = false)
max_index_length = internal ? index_name_length : allowed_index_name_length
if new_name.length > max_index_length

@ -440,7 +440,7 @@ def translate_exception(exception, message)
private
def get_oid_type(oid, fmod, column_name, sql_type = "") # :nodoc:
def get_oid_type(oid, fmod, column_name, sql_type = "")
if !type_map.key?(oid)
load_additional_types(type_map, [oid])
end
@ -453,7 +453,7 @@ def get_oid_type(oid, fmod, column_name, sql_type = "") # :nodoc:
}
end
def initialize_type_map(m) # :nodoc:
def initialize_type_map(m)
register_class_with_limit m, "int2", Type::Integer
register_class_with_limit m, "int4", Type::Integer
register_class_with_limit m, "int8", Type::Integer
@ -521,7 +521,7 @@ def initialize_type_map(m) # :nodoc:
load_additional_types(m)
end
def extract_limit(sql_type) # :nodoc:
def extract_limit(sql_type)
case sql_type
when /^bigint/i, /^int8/i
8
@ -533,7 +533,7 @@ def extract_limit(sql_type) # :nodoc:
end
# Extracts the value from a PostgreSQL column default definition.
def extract_value_from_default(default) # :nodoc:
def extract_value_from_default(default)
case default
# Quoted types
when /\A[\(B]?'(.*)'.*::"?([\w. ]+)"?(?:\[\])?\z/m
@ -559,15 +559,15 @@ def extract_value_from_default(default) # :nodoc:
end
end
def extract_default_function(default_value, default) # :nodoc:
def extract_default_function(default_value, default)
default if has_default_function?(default_value, default)
end
def has_default_function?(default_value, default) # :nodoc:
def has_default_function?(default_value, default)
!default_value && (%r{\w+\(.*\)|\(.*\)::\w+} === default)
end
def load_additional_types(type_map, oids = nil) # :nodoc:
def load_additional_types(type_map, oids = nil)
initializer = OID::TypeMapInitializer.new(type_map)
if supports_ranges?
@ -735,7 +735,7 @@ def configure_connection
end
# Returns the current ID of a table's sequence.
def last_insert_id_result(sequence_name) # :nodoc:
def last_insert_id_result(sequence_name)
exec_query("SELECT currval('#{sequence_name}')", "SQL")
end
@ -757,7 +757,7 @@ def last_insert_id_result(sequence_name) # :nodoc:
# Query implementation notes:
# - format_type includes the column size constraint, e.g. varchar(50)
# - ::regclass is a function that gives the id for a table name
def column_definitions(table_name) # :nodoc:
def column_definitions(table_name)
query(<<-end_sql, "SCHEMA")
SELECT a.attname, format_type(a.atttypid, a.atttypmod),
pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
@ -772,12 +772,12 @@ def column_definitions(table_name) # :nodoc:
end_sql
end
def extract_table_ref_from_insert_sql(sql) # :nodoc:
def extract_table_ref_from_insert_sql(sql)
sql[/into\s("[A-Za-z0-9_."\[\]\s]+"|[A-Za-z0-9_."\[\]]+)\s*/im]
$1.strip if $1
end
def create_table_definition(*args) # :nodoc:
def create_table_definition(*args)
PostgreSQL::TableDefinition.new(*args)
end

@ -299,14 +299,14 @@ def type_caster # :nodoc:
private
def cached_find_by_statement(key, &block) # :nodoc:
def cached_find_by_statement(key, &block)
cache = @find_by_statement_cache[connection.prepared_statements]
cache[key] || cache.synchronize {
cache[key] ||= StatementCache.create(connection, &block)
}
end
def relation # :nodoc:
def relation
relation = Relation.create(self, arel_table, predicate_builder)
if finder_needs_type_condition? && !ignore_default_scope?
@ -316,7 +316,7 @@ def relation # :nodoc:
end
end
def table_metadata # :nodoc:
def table_metadata
TableMetadata.new(self, arel_table)
end
end

@ -69,7 +69,7 @@ def increment_lock
send(lock_col + "=", previous_lock_value + 1)
end
def _create_record(attribute_names = self.attribute_names, *) # :nodoc:
def _create_record(attribute_names = self.attribute_names, *)
if locking_enabled?
# We always want to persist the locking version, even if we don't detect
# a change from the default, since the database might have no default
@ -78,7 +78,7 @@ def _create_record(attribute_names = self.attribute_names, *) # :nodoc:
super
end
def _update_record(attribute_names = self.attribute_names) #:nodoc:
def _update_record(attribute_names = self.attribute_names)
return super unless locking_enabled?
lock_col = self.class.locking_column

@ -66,7 +66,7 @@ def only(*onlies)
private
def relation_with(values) # :nodoc:
def relation_with(values)
result = Relation.create(klass, table, predicate_builder, values)
result.extend(*extending_values) if extending_values.any?
result

@ -61,7 +61,7 @@ def define(info, &block) # :nodoc:
#
# ActiveRecord::Schema.new.migrations_paths
# # => ["db/migrate"] # Rails migration path by default.
def migrations_paths # :nodoc:
def migrations_paths
ActiveRecord::Migrator.migrations_paths
end
end

@ -471,11 +471,11 @@ def transaction_include_any_action?(actions) #:nodoc:
private
def set_transaction_state(state) # :nodoc:
def set_transaction_state(state)
@transaction_state = state
end
def has_transactional_callbacks? # :nodoc:
def has_transactional_callbacks?
!_rollback_callbacks.empty? || !_commit_callbacks.empty? || !_before_commit_callbacks.empty?
end