Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Revert inline docs

  • Loading branch information...
commit aaea12c497ca86a86fbda8409c226630ade22f89 1 parent 297276b
@lifo lifo authored
Showing with 220 additions and 220 deletions.
  1. +4 −4 actionpack/lib/action_controller/routing/route_set.rb
  2. +3 −3 actionpack/lib/action_view/helpers/form_helper.rb
  3. +5 −5 activerecord/lib/active_record/associations.rb
  4. +6 −6 activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
  5. +24 −24 activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
  6. +7 −7 activesupport/lib/active_support/buffered_logger.rb
  7. +14 −14 activesupport/lib/active_support/callbacks.rb
  8. +24 −24 activesupport/lib/active_support/core_ext/class/attribute_accessors.rb
  9. +19 −19 activesupport/lib/active_support/core_ext/class/delegating_attributes.rb
  10. +34 −34 activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
  11. +6 −6 activesupport/lib/active_support/core_ext/logger.rb
  12. +3 −3 activesupport/lib/active_support/core_ext/module/aliasing.rb
  13. +4 −4 activesupport/lib/active_support/core_ext/module/attr_accessor_with_default.rb
  14. +24 −24 activesupport/lib/active_support/core_ext/module/attribute_accessors.rb
  15. +3 −3 activesupport/lib/active_support/core_ext/module/delegation.rb
  16. +5 −5 activesupport/lib/active_support/core_ext/module/synchronization.rb
  17. +28 −28 activesupport/lib/active_support/memoizable.rb
  18. +4 −4 activesupport/lib/active_support/multibyte/unicode_database.rb
  19. +3 −3 activesupport/lib/active_support/time_with_zone.rb
View
8 actionpack/lib/action_controller/routing/route_set.rb
@@ -145,10 +145,10 @@ def named_helper_module_eval(code, *args)
def define_hash_access(route, name, kind, options)
selector = hash_access_name(name, kind)
named_helper_module_eval <<-end_eval # We use module_eval to avoid leaks
- def #{selector}(options = nil) # def hash_for_users_url(options = nil)
- options ? #{options.inspect}.merge(options) : #{options.inspect} # options ? {:only_path=>false}.merge(options) : {:only_path=>false}
- end # end
- protected :#{selector} # protected :hash_for_users_url
+ def #{selector}(options = nil)
+ options ? #{options.inspect}.merge(options) : #{options.inspect}
+ end
+ protected :#{selector}
end_eval
helpers << selector
end
View
6 actionpack/lib/action_view/helpers/form_helper.rb
@@ -737,9 +737,9 @@ def initialize(object_name, object, template, options, proc)
(field_helpers - %w(label check_box radio_button fields_for)).each do |selector|
src = <<-end_src
- def #{selector}(method, options = {}) # def text_field(method, options = {})
- @template.send(#{selector.inspect}, @object_name, method, objectify_options(options)) # @template.send("text_field", @object_name, method, objectify_options(options))
- end # end
+ def #{selector}(method, options = {})
+ @template.send(#{selector.inspect}, @object_name, method, objectify_options(options))
+ end
end_src
class_eval src, __FILE__, __LINE__
end
View
10 activerecord/lib/active_record/associations.rb
@@ -1216,11 +1216,11 @@ def has_and_belongs_to_many(association_id, options = {}, &extension)
# callbacks will be executed after the association is wiped out.
old_method = "destroy_without_habtm_shim_for_#{reflection.name}"
class_eval <<-end_eval unless method_defined?(old_method)
- alias_method :#{old_method}, :destroy_without_callbacks # alias_method :destroy_without_habtm_shim_for_posts, :destroy_without_callbacks
- def destroy_without_callbacks # def destroy_without_callbacks
- #{reflection.name}.clear # posts.clear
- #{old_method} # destroy_without_habtm_shim_for_posts
- end # end
+ alias_method :#{old_method}, :destroy_without_callbacks
+ def destroy_without_callbacks
+ #{reflection.name}.clear
+ #{old_method}
+ end
end_eval
add_association_callbacks(reflection.name, options)
View
12 activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
@@ -14,12 +14,12 @@ def included(base)
def dirties_query_cache(base, *method_names)
method_names.each do |method_name|
base.class_eval <<-end_code, __FILE__, __LINE__
- def #{method_name}_with_query_dirty(*args) # def update_with_query_dirty(*args)
- clear_query_cache if @query_cache_enabled # clear_query_cache if @query_cache_enabled
- #{method_name}_without_query_dirty(*args) # update_without_query_dirty(*args)
- end # end
- #
- alias_method_chain :#{method_name}, :query_dirty # alias_method_chain :update, :query_dirty
+ def #{method_name}_with_query_dirty(*args)
+ clear_query_cache if @query_cache_enabled
+ #{method_name}_without_query_dirty(*args)
+ end
+
+ alias_method_chain :#{method_name}, :query_dirty
end_code
end
end
View
48 activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
@@ -476,12 +476,12 @@ def column(name, type, options = {})
%w( string text integer float decimal datetime timestamp time date binary boolean ).each do |column_type|
class_eval <<-EOV
- def #{column_type}(*args) # def string(*args)
- options = args.extract_options! # options = args.extract_options!
- column_names = args # column_names = args
- #
- column_names.each { |name| column(name, '#{column_type}', options) } # column_names.each { |name| column(name, 'string', options) }
- end # end
+ def #{column_type}(*args)
+ options = args.extract_options!
+ column_names = args
+
+ column_names.each { |name| column(name, '#{column_type}', options) }
+ end
EOV
end
@@ -676,24 +676,24 @@ def remove_references(*args)
# t.string(:goat, :sheep)
%w( string text integer float decimal datetime timestamp time date binary boolean ).each do |column_type|
class_eval <<-EOV
- def #{column_type}(*args) # def string(*args)
- options = args.extract_options! # options = args.extract_options!
- column_names = args # column_names = args
- #
- column_names.each do |name| # column_names.each do |name|
- column = ColumnDefinition.new(@base, name, '#{column_type}') # column = ColumnDefinition.new(@base, name, 'string')
- if options[:limit] # if options[:limit]
- column.limit = options[:limit] # column.limit = options[:limit]
- elsif native['#{column_type}'.to_sym].is_a?(Hash) # elsif native['string'.to_sym].is_a?(Hash)
- column.limit = native['#{column_type}'.to_sym][:limit] # column.limit = native['string'.to_sym][:limit]
- end # end
- column.precision = options[:precision] # column.precision = options[:precision]
- column.scale = options[:scale] # column.scale = options[:scale]
- column.default = options[:default] # column.default = options[:default]
- column.null = options[:null] # column.null = options[:null]
- @base.add_column(@table_name, name, column.sql_type, options) # @base.add_column(@table_name, name, column.sql_type, options)
- end # end
- end # end
+ def #{column_type}(*args)
+ options = args.extract_options!
+ column_names = args
+
+ column_names.each do |name|
+ column = ColumnDefinition.new(@base, name, '#{column_type}')
+ if options[:limit]
+ column.limit = options[:limit]
+ elsif native['#{column_type}'.to_sym].is_a?(Hash)
+ column.limit = native['#{column_type}'.to_sym][:limit]
+ end
+ column.precision = options[:precision]
+ column.scale = options[:scale]
+ column.default = options[:default]
+ column.null = options[:null]
+ @base.add_column(@table_name, name, column.sql_type, options)
+ end
+ end
EOV
end
View
14 activesupport/lib/active_support/buffered_logger.rb
@@ -68,13 +68,13 @@ def add(severity, message = nil, progname = nil, &block)
for severity in Severity.constants
class_eval <<-EOT, __FILE__, __LINE__
- def #{severity.downcase}(message = nil, progname = nil, &block) # def debug(message = nil, progname = nil, &block)
- add(#{severity}, message, progname, &block) # add(DEBUG, message, progname, &block)
- end # end
- #
- def #{severity.downcase}? # def debug?
- #{severity} >= @level # DEBUG >= @level
- end # end
+ def #{severity.downcase}(message = nil, progname = nil, &block)
+ add(#{severity}, message, progname, &block)
+ end
+
+ def #{severity.downcase}?
+ #{severity} >= @level
+ end
EOT
end
View
28 activesupport/lib/active_support/callbacks.rb
@@ -210,20 +210,20 @@ module ClassMethods
def define_callbacks(*callbacks)
callbacks.each do |callback|
class_eval <<-"end_eval"
- def self.#{callback}(*methods, &block) # def self.before_save(*methods, &block)
- callbacks = CallbackChain.build(:#{callback}, *methods, &block) # callbacks = CallbackChain.build(:before_save, *methods, &block)
- (@#{callback}_callbacks ||= CallbackChain.new).concat callbacks # (@before_save_callbacks ||= CallbackChain.new).concat callbacks
- end # end
- #
- def self.#{callback}_callback_chain # def self.before_save_callback_chain
- @#{callback}_callbacks ||= CallbackChain.new # @before_save_callbacks ||= CallbackChain.new
- #
- if superclass.respond_to?(:#{callback}_callback_chain) # if superclass.respond_to?(:before_save_callback_chain)
- CallbackChain.new(superclass.#{callback}_callback_chain + @#{callback}_callbacks) # CallbackChain.new(superclass.before_save_callback_chain + @before_save_callbacks)
- else # else
- @#{callback}_callbacks # @before_save_callbacks
- end # end
- end # end
+ def self.#{callback}(*methods, &block)
+ callbacks = CallbackChain.build(:#{callback}, *methods, &block)
+ (@#{callback}_callbacks ||= CallbackChain.new).concat callbacks
+ end
+
+ def self.#{callback}_callback_chain
+ @#{callback}_callbacks ||= CallbackChain.new
+
+ if superclass.respond_to?(:#{callback}_callback_chain)
+ CallbackChain.new(superclass.#{callback}_callback_chain + @#{callback}_callbacks)
+ else
+ @#{callback}_callbacks
+ end
+ end
end_eval
end
end
View
48 activesupport/lib/active_support/core_ext/class/attribute_accessors.rb
@@ -11,17 +11,17 @@ def cattr_reader(*syms)
syms.flatten.each do |sym|
next if sym.is_a?(Hash)
class_eval(<<-EOS, __FILE__, __LINE__)
- 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
- #
- def #{sym} # def hair_colors
- @@#{sym} # @@hair_colors
- end # end
+ unless defined? @@#{sym}
+ @@#{sym} = nil
+ end
+
+ def self.#{sym}
+ @@#{sym}
+ end
+
+ def #{sym}
+ @@#{sym}
+ end
EOS
end
end
@@ -30,19 +30,19 @@ def cattr_writer(*syms)
options = syms.extract_options!
syms.flatten.each do |sym|
class_eval(<<-EOS, __FILE__, __LINE__)
- 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
+
+ #{"
+ def #{sym}=(obj)
+ @@#{sym} = obj
+ end
+ " unless options[:instance_writer] == false }
EOS
end
end
View
38 activesupport/lib/active_support/core_ext/class/delegating_attributes.rb
@@ -9,22 +9,22 @@ def superclass_delegating_reader(*names)
class_name_to_stop_searching_on = self.superclass.name.blank? ? "Object" : self.superclass.name
names.each do |name|
class_eval <<-EOS
- def self.#{name} # def self.only_reader
- if defined?(@#{name}) # if defined?(@only_reader)
- @#{name} # @only_reader
- elsif superclass < #{class_name_to_stop_searching_on} && superclass.respond_to?(:#{name}) # elsif superclass < Object && superclass.respond_to?(:only_reader)
- superclass.#{name} # superclass.only_reader
- end # end
- end # end
- def #{name} # def only_reader
- self.class.#{name} # self.class.only_reader
- end # end
- def self.#{name}? # def self.only_reader?
- !!#{name} # !!only_reader
- end # end
- def #{name}? # def only_reader?
- !!#{name} # !!only_reader
- end # end
+ def self.#{name}
+ if defined?(@#{name})
+ @#{name}
+ elsif superclass < #{class_name_to_stop_searching_on} && superclass.respond_to?(:#{name})
+ superclass.#{name}
+ end
+ end
+ def #{name}
+ self.class.#{name}
+ end
+ def self.#{name}?
+ !!#{name}
+ end
+ def #{name}?
+ !!#{name}
+ end
EOS
end
end
@@ -32,9 +32,9 @@ def #{name}?
def superclass_delegating_writer(*names)
names.each do |name|
class_eval <<-EOS
- def self.#{name}=(value) # def self.only_writer=(value)
- @#{name} = value # @only_writer = value
- end # end
+ def self.#{name}=(value)
+ @#{name} = value
+ end
EOS
end
end
View
68 activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
@@ -11,13 +11,13 @@ def class_inheritable_reader(*syms)
syms.each do |sym|
next if sym.is_a?(Hash)
class_eval <<-EOS
- def self.#{sym} # def self.before_add_for_comments
- read_inheritable_attribute(:#{sym}) # read_inheritable_attribute(:before_add_for_comments)
- end # end
- #
- def #{sym} # def before_add_for_comments
- self.class.#{sym} # self.class.before_add_for_comments
- end # end
+ def self.#{sym}
+ read_inheritable_attribute(:#{sym})
+ end
+
+ def #{sym}
+ self.class.#{sym}
+ end
EOS
end
end
@@ -26,15 +26,15 @@ def class_inheritable_writer(*syms)
options = syms.extract_options!
syms.each do |sym|
class_eval <<-EOS
- def self.#{sym}=(obj) # def self.color=(obj)
- write_inheritable_attribute(:#{sym}, obj) # write_inheritable_attribute(:color, obj)
- end # end
- #
- #{" #
- def #{sym}=(obj) # def color=(obj)
- self.class.#{sym} = obj # self.class.color = obj
- end # end
- " unless options[:instance_writer] == false } # # the writer above is generated unless options[:instance_writer] == false
+ def self.#{sym}=(obj)
+ write_inheritable_attribute(:#{sym}, obj)
+ end
+
+ #{"
+ def #{sym}=(obj)
+ self.class.#{sym} = obj
+ end
+ " unless options[:instance_writer] == false }
EOS
end
end
@@ -43,15 +43,15 @@ def class_inheritable_array_writer(*syms)
options = syms.extract_options!
syms.each do |sym|
class_eval <<-EOS
- def self.#{sym}=(obj) # def self.levels=(obj)
- write_inheritable_array(:#{sym}, obj) # write_inheritable_array(:levels, obj)
- end # end
- #
- #{" #
- def #{sym}=(obj) # def levels=(obj)
- self.class.#{sym} = obj # self.class.levels = obj
- end # end
- " unless options[:instance_writer] == false } # # the writer above is generated unless options[:instance_writer] == false
+ def self.#{sym}=(obj)
+ write_inheritable_array(:#{sym}, obj)
+ end
+
+ #{"
+ def #{sym}=(obj)
+ self.class.#{sym} = obj
+ end
+ " unless options[:instance_writer] == false }
EOS
end
end
@@ -60,15 +60,15 @@ def class_inheritable_hash_writer(*syms)
options = syms.extract_options!
syms.each do |sym|
class_eval <<-EOS
- def self.#{sym}=(obj) # def self.nicknames=(obj)
- write_inheritable_hash(:#{sym}, obj) # write_inheritable_hash(:nicknames, obj)
- end # end
- #
- #{" #
- def #{sym}=(obj) # def nicknames=(obj)
- self.class.#{sym} = obj # self.class.nicknames = obj
- end # end
- " unless options[:instance_writer] == false } # # the writer above is generated unless options[:instance_writer] == false
+ def self.#{sym}=(obj)
+ write_inheritable_hash(:#{sym}, obj)
+ end
+
+ #{"
+ def #{sym}=(obj)
+ self.class.#{sym} = obj
+ end
+ " unless options[:instance_writer] == false }
EOS
end
end
View
12 activesupport/lib/active_support/core_ext/logger.rb
@@ -3,12 +3,12 @@
class Logger
def self.define_around_helper(level)
module_eval <<-end_eval
- def around_#{level}(before_message, after_message, &block) # def around_debug(before_message, after_message, &block)
- self.#{level}(before_message) # self.debug(before_message)
- return_value = block.call(self) # return_value = block.call(self)
- self.#{level}(after_message) # self.debug(after_message)
- return return_value # return return_value
- end # end
+ def around_#{level}(before_message, after_message, &block)
+ self.#{level}(before_message)
+ return_value = block.call(self)
+ self.#{level}(after_message)
+ return return_value
+ end
end_eval
end
[:debug, :info, :error, :fatal].each {|level| define_around_helper(level) }
View
6 activesupport/lib/active_support/core_ext/module/aliasing.rb
@@ -64,9 +64,9 @@ def alias_method_chain(target, feature)
# e.title # => "Megastars"
def alias_attribute(new_name, old_name)
module_eval <<-STR, __FILE__, __LINE__+1
- def #{new_name}; self.#{old_name}; end # def subject; self.title; end
- def #{new_name}?; self.#{old_name}?; end # def subject?; self.title?; end
- def #{new_name}=(v); self.#{old_name} = v; end # def subject=(v); self.title = v; end
+ def #{new_name}; self.#{old_name}; end
+ def #{new_name}?; self.#{old_name}?; end
+ def #{new_name}=(v); self.#{old_name} = v; end
STR
end
end
View
8 activesupport/lib/active_support/core_ext/module/attr_accessor_with_default.rb
@@ -22,10 +22,10 @@ def attr_accessor_with_default(sym, default = nil, &block)
raise 'Default value or block required' unless !default.nil? || block
define_method(sym, block_given? ? block : Proc.new { default })
module_eval(<<-EVAL, __FILE__, __LINE__)
- def #{sym}=(value) # def age=(value)
- class << self; attr_reader :#{sym} end # class << self; attr_reader :age end
- @#{sym} = value # @age = value
- end # end
+ def #{sym}=(value)
+ class << self; attr_reader :#{sym} end
+ @#{sym} = value
+ end
EVAL
end
end
View
48 activesupport/lib/active_support/core_ext/module/attribute_accessors.rb
@@ -15,17 +15,17 @@ def mattr_reader(*syms)
syms.each do |sym|
next if sym.is_a?(Hash)
class_eval(<<-EOS, __FILE__, __LINE__)
- unless defined? @@#{sym} # unless defined? @@pagination_options
- @@#{sym} = nil # @@pagination_options = nil
- end # end
- #
- def self.#{sym} # def self.pagination_options
- @@#{sym} # @@pagination_options
- end # end
- #
- def #{sym} # def pagination_options
- @@#{sym} # @@pagination_options
- end # end
+ unless defined? @@#{sym}
+ @@#{sym} = nil
+ end
+
+ def self.#{sym}
+ @@#{sym}
+ end
+
+ def #{sym}
+ @@#{sym}
+ end
EOS
end
end
@@ -34,19 +34,19 @@ def mattr_writer(*syms)
options = syms.extract_options!
syms.each do |sym|
class_eval(<<-EOS, __FILE__, __LINE__)
- unless defined? @@#{sym} # unless defined? @@pagination_options
- @@#{sym} = nil # @@pagination_options = nil
- end # end
- #
- def self.#{sym}=(obj) # def self.pagination_options=(obj)
- @@#{sym} = obj # @@pagination_options = obj
- end # end
- #
- #{" #
- def #{sym}=(obj) # def pagination_options=(obj)
- @@#{sym} = obj # @@pagination_options = 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
+
+ #{"
+ def #{sym}=(obj)
+ @@#{sym} = obj
+ end
+ " unless options[:instance_writer] == false }
EOS
end
end
View
6 activesupport/lib/active_support/core_ext/module/delegation.rb
@@ -112,9 +112,9 @@ def delegate(*methods)
methods.each do |method|
module_eval(<<-EOS, "(__DELEGATION__)", 1)
- def #{prefix}#{method}(*args, &block) # def customer_name(*args, &block)
- #{allow_nil}#{to}.__send__(#{method.inspect}, *args, &block) # client && client.__send__(:name, *args, &block)
- end # end
+ def #{prefix}#{method}(*args, &block)
+ #{allow_nil}#{to}.__send__(#{method.inspect}, *args, &block)
+ end
EOS
end
end
View
10 activesupport/lib/active_support/core_ext/module/synchronization.rb
@@ -26,11 +26,11 @@ def synchronize(*methods)
end
module_eval(<<-EOS, __FILE__, __LINE__)
- def #{aliased_method}_with_synchronization#{punctuation}(*args, &block) # def expire_with_synchronization(*args, &block)
- #{with}.synchronize do # @@lock.synchronize do
- #{aliased_method}_without_synchronization#{punctuation}(*args, &block) # expire_without_synchronization(*args, &block)
- end # end
- end # end
+ def #{aliased_method}_with_synchronization#{punctuation}(*args, &block)
+ #{with}.synchronize do
+ #{aliased_method}_without_synchronization#{punctuation}(*args, &block)
+ end
+ end
EOS
alias_method_chain method, :synchronization
View
56 activesupport/lib/active_support/memoizable.rb
@@ -59,34 +59,34 @@ def memoize(*symbols)
memoized_ivar = ActiveSupport::Memoizable.memoized_ivar_for(symbol)
class_eval <<-EOS, __FILE__, __LINE__
- include InstanceMethods # include InstanceMethods
- #
- raise "Already memoized #{symbol}" if method_defined?(:#{original_method}) # raise "Already memoized mime_type" if method_defined?(:_unmemoized_mime_type)
- alias #{original_method} #{symbol} # alias _unmemoized_mime_type mime_type
- #
- if instance_method(:#{symbol}).arity == 0 # if instance_method(:mime_type).arity == 0
- def #{symbol}(reload = false) # def mime_type(reload = false)
- if reload || !defined?(#{memoized_ivar}) || #{memoized_ivar}.empty? # if reload || !defined?(@_memoized_mime_type) || @_memoized_mime_type.empty?
- #{memoized_ivar} = [#{original_method}.freeze] # @_memoized_mime_type = [_unmemoized_mime_type.freeze]
- end # end
- #{memoized_ivar}[0] # @_memoized_mime_type[0]
- end # end
- else # else
- def #{symbol}(*args) # def mime_type(*args)
- #{memoized_ivar} ||= {} unless frozen? # @_memoized_mime_type ||= {} unless frozen?
- reload = args.pop if args.last == true || args.last == :reload # reload = args.pop if args.last == true || args.last == :reload
- #
- if defined?(#{memoized_ivar}) && #{memoized_ivar} # if defined?(@_memoized_mime_type) && @_memoized_mime_type
- if !reload && #{memoized_ivar}.has_key?(args) # if !reload && @_memoized_mime_type.has_key?(args)
- #{memoized_ivar}[args] # @_memoized_mime_type[args]
- elsif #{memoized_ivar} # elsif @_memoized_mime_type
- #{memoized_ivar}[args] = #{original_method}(*args).freeze # @_memoized_mime_type[args] = _unmemoized_mime_type(*args).freeze
- end # end
- else # else
- #{original_method}(*args) # _unmemoized_mime_type(*args)
- end # end
- end # end
- end # end
+ include InstanceMethods
+
+ raise "Already memoized #{symbol}" if method_defined?(:#{original_method})
+ alias #{original_method} #{symbol}
+
+ if instance_method(:#{symbol}).arity == 0
+ def #{symbol}(reload = false)
+ if reload || !defined?(#{memoized_ivar}) || #{memoized_ivar}.empty?
+ #{memoized_ivar} = [#{original_method}.freeze]
+ end
+ #{memoized_ivar}[0]
+ end
+ else
+ def #{symbol}(*args)
+ #{memoized_ivar} ||= {} unless frozen?
+ reload = args.pop if args.last == true || args.last == :reload
+
+ if defined?(#{memoized_ivar}) && #{memoized_ivar}
+ if !reload && #{memoized_ivar}.has_key?(args)
+ #{memoized_ivar}[args]
+ elsif #{memoized_ivar}
+ #{memoized_ivar}[args] = #{original_method}(*args).freeze
+ end
+ else
+ #{original_method}(*args)
+ end
+ end
+ end
EOS
end
end
View
8 activesupport/lib/active_support/multibyte/unicode_database.rb
@@ -24,10 +24,10 @@ def initialize
# Lazy load the Unicode database so it's only loaded when it's actually used
ATTRIBUTES.each do |attr_name|
class_eval(<<-EOS, __FILE__, __LINE__)
- def #{attr_name} # def codepoints
- load # load
- @#{attr_name} # @codepoints
- end # end
+ def #{attr_name}
+ load
+ @#{attr_name}
+ end
EOS
end
View
6 activesupport/lib/active_support/time_with_zone.rb
@@ -234,9 +234,9 @@ def advance(options)
%w(year mon month day mday wday yday hour min sec to_date).each do |method_name|
class_eval <<-EOV
- def #{method_name} # def year
- time.#{method_name} # time.year
- end # end
+ def #{method_name}
+ time.#{method_name}
+ end
EOV
end
Please sign in to comment.
Something went wrong with that request. Please try again.