aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-07-14 13:26:45 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-07-14 13:26:45 +0900
commit12e6cba9cf5d2e29438751e0922b27d75da8b0c6 (patch)
tree57ae37a948512f0d5486d1a5ab1beeae0799ee29 /activemodel
parent2992faa45b1b3842e1df30384bba496bb315d09d (diff)
downloadrails-12e6cba9cf5d2e29438751e0922b27d75da8b0c6.tar.gz
rails-12e6cba9cf5d2e29438751e0922b27d75da8b0c6.tar.bz2
rails-12e6cba9cf5d2e29438751e0922b27d75da8b0c6.zip
Make `generated_attribute_methods` to private
Because `generated_attribute_methods` is an internal API.
Diffstat (limited to 'activemodel')
-rw-r--r--activemodel/lib/active_model/attribute_methods.rb8
-rw-r--r--activemodel/test/cases/attribute_methods_test.rb2
2 files changed, 5 insertions, 5 deletions
diff --git a/activemodel/lib/active_model/attribute_methods.rb b/activemodel/lib/active_model/attribute_methods.rb
index e4caf551ad..af08e67d94 100644
--- a/activemodel/lib/active_model/attribute_methods.rb
+++ b/activemodel/lib/active_model/attribute_methods.rb
@@ -326,11 +326,11 @@ module ActiveModel
attribute_method_matchers_cache.clear
end
- def generated_attribute_methods #:nodoc:
- @generated_attribute_methods ||= Module.new.tap { |mod| include mod }
- end
-
private
+ def generated_attribute_methods
+ @generated_attribute_methods ||= Module.new.tap { |mod| include mod }
+ end
+
def instance_method_already_implemented?(method_name)
generated_attribute_methods.method_defined?(method_name)
end
diff --git a/activemodel/test/cases/attribute_methods_test.rb b/activemodel/test/cases/attribute_methods_test.rb
index 4767accb7c..ab46bdf489 100644
--- a/activemodel/test/cases/attribute_methods_test.rb
+++ b/activemodel/test/cases/attribute_methods_test.rb
@@ -116,7 +116,7 @@ class AttributeMethodsTest < ActiveModel::TestCase
test "#define_attribute_method does not generate attribute method if already defined in attribute module" do
klass = Class.new(ModelWithAttributes)
- klass.generated_attribute_methods.module_eval do
+ klass.send(:generated_attribute_methods).module_eval do
def foo
"<3"
end