diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-02-26 06:14:17 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2018-02-26 06:16:24 +0900 |
commit | 3579876931381fd6abff99bd6e739169a8fcb489 (patch) | |
tree | e56cb9b801b92d699c548e179933f841d69f62db | |
parent | 91b30a001b79096b60d9424a4664a417dce0b767 (diff) | |
download | rails-3579876931381fd6abff99bd6e739169a8fcb489.tar.gz rails-3579876931381fd6abff99bd6e739169a8fcb489.tar.bz2 rails-3579876931381fd6abff99bd6e739169a8fcb489.zip |
Active Model: Use private attr_reader
Follow up of 6d63b5e49a399fe246afcebad45c3c962de268fa.
4 files changed, 6 insertions, 11 deletions
diff --git a/activemodel/lib/active_model/attribute.rb b/activemodel/lib/active_model/attribute.rb index 27f3e38e31..3f19cda07b 100644 --- a/activemodel/lib/active_model/attribute.rb +++ b/activemodel/lib/active_model/attribute.rb @@ -133,10 +133,6 @@ module ActiveModel end protected - - attr_reader :original_attribute - alias_method :assigned?, :original_attribute - def original_value_for_database if assigned? original_attribute.original_value_for_database @@ -146,6 +142,9 @@ module ActiveModel end private + attr_reader :original_attribute + alias :assigned? :original_attribute + def initialize_dup(other) if defined?(@value) && @value.duplicable? @value = @value.dup diff --git a/activemodel/lib/active_model/attribute/user_provided_default.rb b/activemodel/lib/active_model/attribute/user_provided_default.rb index a5dc6188d2..9dc16e882d 100644 --- a/activemodel/lib/active_model/attribute/user_provided_default.rb +++ b/activemodel/lib/active_model/attribute/user_provided_default.rb @@ -44,8 +44,7 @@ module ActiveModel end end - protected - + private attr_reader :user_provided_value end end diff --git a/activemodel/lib/active_model/attribute_set/builder.rb b/activemodel/lib/active_model/attribute_set/builder.rb index bf2d06b48a..2b1c2206ec 100644 --- a/activemodel/lib/active_model/attribute_set/builder.rb +++ b/activemodel/lib/active_model/attribute_set/builder.rb @@ -90,9 +90,6 @@ module ActiveModel end protected - - attr_reader :types, :values, :additional_types, :delegate_hash, :default_attributes - def materialize unless @materialized values.each_key { |key| self[key] } @@ -105,6 +102,7 @@ module ActiveModel end private + attr_reader :types, :values, :additional_types, :delegate_hash, :default_attributes def assign_default_value(name) type = additional_types.fetch(name, types[name]) diff --git a/activemodel/lib/active_model/attribute_set/yaml_encoder.rb b/activemodel/lib/active_model/attribute_set/yaml_encoder.rb index 4ea945b956..ea1efc160e 100644 --- a/activemodel/lib/active_model/attribute_set/yaml_encoder.rb +++ b/activemodel/lib/active_model/attribute_set/yaml_encoder.rb @@ -33,8 +33,7 @@ module ActiveModel end end - protected - + private attr_reader :default_types end end |