aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2010-03-27 11:29:10 -0300
committerJosé Valim <jose.valim@gmail.com>2010-03-27 16:42:52 +0100
commit820e3a8491100ed24a6a33df07afee341956a45c (patch)
tree12fcbaea962731816db1f95b79a666864e5c484d /activesupport
parentedbb9526d315444d560362487b78e03b2f3d7a61 (diff)
downloadrails-820e3a8491100ed24a6a33df07afee341956a45c.tar.gz
rails-820e3a8491100ed24a6a33df07afee341956a45c.tar.bz2
rails-820e3a8491100ed24a6a33df07afee341956a45c.zip
LINE on class_eval need + 1, also removed comments [#4281 state:committed]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/class/attribute_accessors.rb51
-rw-r--r--activesupport/lib/active_support/core_ext/module/attribute_accessors.rb40
2 files changed, 47 insertions, 44 deletions
diff --git a/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb b/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb
index be34a5a96f..feef5d2d57 100644
--- a/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb
+++ b/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb
@@ -13,19 +13,20 @@ class Class
options = syms.extract_options!
syms.each do |sym|
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
- unless defined? @@#{sym} # unless defined? @@hair_colors
- @@#{sym} = nil # @@hair_colors = nil
- end # end
- #
- def self.#{sym} # def self.hair_colors
- @@#{sym} # @@hair_colors
- end # end
+ unless defined? @@#{sym}
+ @@#{sym} = nil
+ end
+
+ def self.#{sym}
+ @@#{sym}
+ end
EOS
+
unless options[:instance_reader] == false
- class_eval(<<-EOS, __FILE__, __LINE__)
- def #{sym} # def hair_colors
- @@#{sym} # @@hair_colors
- end # end
+ class_eval(<<-EOS, __FILE__, __LINE__ + 1)
+ def #{sym}
+ @@#{sym}
+ end
EOS
end
end
@@ -35,20 +36,22 @@ class Class
options = syms.extract_options!
syms.each do |sym|
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
- unless defined? @@#{sym} # unless defined? @@hair_colors
- @@#{sym} = nil # @@hair_colors = nil
- end # end
- #
- def self.#{sym}=(obj) # def self.hair_colors=(obj)
- @@#{sym} = obj # @@hair_colors = obj
- end # end
- #
- #{" #
- def #{sym}=(obj) # def hair_colors=(obj)
- @@#{sym} = obj # @@hair_colors = obj
- end # end
- " unless options[:instance_writer] == false } # # instance writer above is generated unless options[:instance_writer] == false
+ unless defined? @@#{sym}
+ @@#{sym} = nil
+ end
+
+ def self.#{sym}=(obj)
+ @@#{sym} = obj
+ end
EOS
+
+ unless options[:instance_writer] == false
+ class_eval(<<-EOS, __FILE__, __LINE__ + 1)
+ def #{sym}=(obj)
+ @@#{sym} = obj
+ end
+ EOS
+ end
self.send("#{sym}=", yield) if block_given?
end
end
diff --git a/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb b/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb
index c315fd5812..9c4d5fae26 100644
--- a/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb
+++ b/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb
@@ -5,20 +5,20 @@ class Module
options = syms.extract_options!
syms.each do |sym|
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
- unless defined? @@#{sym} # unless defined? @@pagination_options
- @@#{sym} = nil # @@pagination_options = nil
- end # end
+ unless defined? @@#{sym}
+ @@#{sym} = nil
+ end
- def self.#{sym} # def self.pagination_options
- @@#{sym} # @@pagination_options
- end # end
+ def self.#{sym}
+ @@#{sym}
+ end
EOS
unless options[:instance_reader] == false
- class_eval(<<-EOS, __FILE__, __LINE__)
- def #{sym} # def hair_colors
- @@#{sym} # @@hair_colors
- end # end
+ class_eval(<<-EOS, __FILE__, __LINE__ + 1)
+ def #{sym}
+ @@#{sym}
+ end
EOS
end
end
@@ -28,20 +28,20 @@ class Module
options = syms.extract_options!
syms.each do |sym|
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
- unless defined? @@#{sym} # unless defined? @@pagination_options
- @@#{sym} = nil # @@pagination_options = nil
- end # end
+ unless defined? @@#{sym}
+ @@#{sym} = nil
+ end
- def self.#{sym}=(obj) # def self.pagination_options=(obj)
- @@#{sym} = obj # @@pagination_options = obj
- end # end
+ def self.#{sym}=(obj)
+ @@#{sym} = obj
+ end
EOS
unless options[:instance_writer] == false
- class_eval(<<-EOS, __FILE__, __LINE__)
- def #{sym}=(obj) # def pagination_options=(obj)
- @@#{sym} = obj # @@pagination_options = obj
- end # end
+ class_eval(<<-EOS, __FILE__, __LINE__ + 1)
+ def #{sym}=(obj)
+ @@#{sym} = obj
+ end
EOS
end
end