aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2011-02-03 20:37:02 -0200
committerSantiago Pastorino <santiago@wyeworks.com>2011-02-03 20:37:12 -0200
commit6f4d9989dd1b4d396aa8c37c9a9a7f240911d9b5 (patch)
tree88fcb707318649730adc387f62012a8638e3b6f8 /activemodel
parentd3cfee118245a8806436bbf904bbad36dd810012 (diff)
downloadrails-6f4d9989dd1b4d396aa8c37c9a9a7f240911d9b5.tar.gz
rails-6f4d9989dd1b4d396aa8c37c9a9a7f240911d9b5.tar.bz2
rails-6f4d9989dd1b4d396aa8c37c9a9a7f240911d9b5.zip
method_defined?, define_method and send accepts a string as argument
Diffstat (limited to 'activemodel')
-rw-r--r--activemodel/lib/active_model/attribute_methods.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/activemodel/lib/active_model/attribute_methods.rb b/activemodel/lib/active_model/attribute_methods.rb
index f46fa3a5e2..9a89b0db9c 100644
--- a/activemodel/lib/active_model/attribute_methods.rb
+++ b/activemodel/lib/active_model/attribute_methods.rb
@@ -98,7 +98,7 @@ module ActiveModel
def define_attr_method(name, value=nil, &block)
sing = singleton_class
sing.class_eval <<-eorb, __FILE__, __LINE__ + 1
- if method_defined?(:'original_#{name}')
+ if method_defined?('original_#{name}')
undef :'original_#{name}'
end
alias_method :'original_#{name}', :'#{name}'
@@ -230,8 +230,8 @@ module ActiveModel
def alias_attribute(new_name, old_name)
attribute_method_matchers.each do |matcher|
module_eval <<-STR, __FILE__, __LINE__ + 1
- define_method(:'#{matcher.method_name(new_name)}') do |*args|
- send(:'#{matcher.method_name(old_name)}', *args)
+ define_method('#{matcher.method_name(new_name)}') do |*args|
+ send('#{matcher.method_name(old_name)}', *args)
end
STR
end
@@ -274,11 +274,11 @@ module ActiveModel
method_name = matcher.method_name(attr_name)
generated_attribute_methods.module_eval <<-STR, __FILE__, __LINE__ + 1
- if method_defined?(:'#{method_name}')
+ if method_defined?('#{method_name}')
undef :'#{method_name}'
end
- define_method(:'#{method_name}') do |*args|
- send(:'#{matcher.method_missing_target}', '#{attr_name}', *args)
+ define_method('#{method_name}') do |*args|
+ send('#{matcher.method_missing_target}', '#{attr_name}', *args)
end
STR
end