Guest User

Untitled

a guest
Feb 21st, 2018
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 39.77 KB | None | 0 0
  1. commit 96e2c827ea2d6f147fbcfc1d986f39f146df3b6e
  2. Author: Pratik Naik <pratiknaik@gmail.com>
  3. Date: Sun Dec 28 16:03:49 2008 +0000
  4.  
  5. Revert "Revert inline docs"
  6.  
  7. This reverts commit aaea12c497ca86a86fbda8409c226630ade22f89.
  8.  
  9. diff --git a/actionpack/lib/action_controller/routing/route_set.rb b/actionpack/lib/action_controller/routing/route_set.rb
  10. index 13646ae..d4c53ff 100644
  11. --- a/actionpack/lib/action_controller/routing/route_set.rb
  12. +++ b/actionpack/lib/action_controller/routing/route_set.rb
  13. @@ -145,10 +145,10 @@ module ActionController
  14. def define_hash_access(route, name, kind, options)
  15. selector = hash_access_name(name, kind)
  16. named_helper_module_eval <<-end_eval # We use module_eval to avoid leaks
  17. - def #{selector}(options = nil)
  18. - options ? #{options.inspect}.merge(options) : #{options.inspect}
  19. - end
  20. - protected :#{selector}
  21. + def #{selector}(options = nil) # def hash_for_users_url(options = nil)
  22. + options ? #{options.inspect}.merge(options) : #{options.inspect} # options ? {:only_path=>false}.merge(options) : {:only_path=>false}
  23. + end # end
  24. + protected :#{selector} # protected :hash_for_users_url
  25. end_eval
  26. helpers << selector
  27. end
  28. diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb
  29. index 621e294..f23a0f7 100644
  30. --- a/actionpack/lib/action_view/helpers/form_helper.rb
  31. +++ b/actionpack/lib/action_view/helpers/form_helper.rb
  32. @@ -737,9 +737,9 @@ module ActionView
  33.  
  34. (field_helpers - %w(label check_box radio_button fields_for)).each do |selector|
  35. src = <<-end_src
  36. - def #{selector}(method, options = {})
  37. - @template.send(#{selector.inspect}, @object_name, method, objectify_options(options))
  38. - end
  39. + def #{selector}(method, options = {}) # def text_field(method, options = {})
  40. + @template.send(#{selector.inspect}, @object_name, method, objectify_options(options)) # @template.send("text_field", @object_name, method, objectify_options(options))
  41. + end # end
  42. end_src
  43. class_eval src, __FILE__, __LINE__
  44. end
  45. diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
  46. index 5a60b13..1984f8d 100755
  47. --- a/activerecord/lib/active_record/associations.rb
  48. +++ b/activerecord/lib/active_record/associations.rb
  49. @@ -1216,11 +1216,11 @@ module ActiveRecord
  50. # callbacks will be executed after the association is wiped out.
  51. old_method = "destroy_without_habtm_shim_for_#{reflection.name}"
  52. class_eval <<-end_eval unless method_defined?(old_method)
  53. - alias_method :#{old_method}, :destroy_without_callbacks
  54. - def destroy_without_callbacks
  55. - #{reflection.name}.clear
  56. - #{old_method}
  57. - end
  58. + alias_method :#{old_method}, :destroy_without_callbacks # alias_method :destroy_without_habtm_shim_for_posts, :destroy_without_callbacks
  59. + def destroy_without_callbacks # def destroy_without_callbacks
  60. + #{reflection.name}.clear # posts.clear
  61. + #{old_method} # destroy_without_habtm_shim_for_posts
  62. + end # end
  63. end_eval
  64.  
  65. add_association_callbacks(reflection.name, options)
  66. diff --git a/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb b/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
  67. index 950bd72..581c889 100644
  68. --- a/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
  69. +++ b/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
  70. @@ -14,12 +14,12 @@ module ActiveRecord
  71. def dirties_query_cache(base, *method_names)
  72. method_names.each do |method_name|
  73. base.class_eval <<-end_code, __FILE__, __LINE__
  74. - def #{method_name}_with_query_dirty(*args)
  75. - clear_query_cache if @query_cache_enabled
  76. - #{method_name}_without_query_dirty(*args)
  77. - end
  78. -
  79. - alias_method_chain :#{method_name}, :query_dirty
  80. + def #{method_name}_with_query_dirty(*args) # def update_with_query_dirty(*args)
  81. + clear_query_cache if @query_cache_enabled # clear_query_cache if @query_cache_enabled
  82. + #{method_name}_without_query_dirty(*args) # update_without_query_dirty(*args)
  83. + end # end
  84. + #
  85. + alias_method_chain :#{method_name}, :query_dirty # alias_method_chain :update, :query_dirty
  86. end_code
  87. end
  88. end
  89. diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
  90. index fe9cbcf..a65e8bf 100644
  91. --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
  92. +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
  93. @@ -476,12 +476,12 @@ module ActiveRecord
  94.  
  95. %w( string text integer float decimal datetime timestamp time date binary boolean ).each do |column_type|
  96. class_eval <<-EOV
  97. - def #{column_type}(*args)
  98. - options = args.extract_options!
  99. - column_names = args
  100. -
  101. - column_names.each { |name| column(name, '#{column_type}', options) }
  102. - end
  103. + def #{column_type}(*args) # def string(*args)
  104. + options = args.extract_options! # options = args.extract_options!
  105. + column_names = args # column_names = args
  106. + #
  107. + column_names.each { |name| column(name, '#{column_type}', options) } # column_names.each { |name| column(name, 'string', options) }
  108. + end # end
  109. EOV
  110. end
  111.  
  112. @@ -676,24 +676,24 @@ module ActiveRecord
  113. # t.string(:goat, :sheep)
  114. %w( string text integer float decimal datetime timestamp time date binary boolean ).each do |column_type|
  115. class_eval <<-EOV
  116. - def #{column_type}(*args)
  117. - options = args.extract_options!
  118. - column_names = args
  119. -
  120. - column_names.each do |name|
  121. - column = ColumnDefinition.new(@base, name, '#{column_type}')
  122. - if options[:limit]
  123. - column.limit = options[:limit]
  124. - elsif native['#{column_type}'.to_sym].is_a?(Hash)
  125. - column.limit = native['#{column_type}'.to_sym][:limit]
  126. - end
  127. - column.precision = options[:precision]
  128. - column.scale = options[:scale]
  129. - column.default = options[:default]
  130. - column.null = options[:null]
  131. - @base.add_column(@table_name, name, column.sql_type, options)
  132. - end
  133. - end
  134. + def #{column_type}(*args) # def string(*args)
  135. + options = args.extract_options! # options = args.extract_options!
  136. + column_names = args # column_names = args
  137. + #
  138. + column_names.each do |name| # column_names.each do |name|
  139. + column = ColumnDefinition.new(@base, name, '#{column_type}') # column = ColumnDefinition.new(@base, name, 'string')
  140. + if options[:limit] # if options[:limit]
  141. + column.limit = options[:limit] # column.limit = options[:limit]
  142. + elsif native['#{column_type}'.to_sym].is_a?(Hash) # elsif native['string'.to_sym].is_a?(Hash)
  143. + column.limit = native['#{column_type}'.to_sym][:limit] # column.limit = native['string'.to_sym][:limit]
  144. + end # end
  145. + column.precision = options[:precision] # column.precision = options[:precision]
  146. + column.scale = options[:scale] # column.scale = options[:scale]
  147. + column.default = options[:default] # column.default = options[:default]
  148. + column.null = options[:null] # column.null = options[:null]
  149. + @base.add_column(@table_name, name, column.sql_type, options) # @base.add_column(@table_name, name, column.sql_type, options)
  150. + end # end
  151. + end # end
  152. EOV
  153. end
  154.  
  155. diff --git a/activesupport/lib/active_support/buffered_logger.rb b/activesupport/lib/active_support/buffered_logger.rb
  156. index 445d8ed..5794ee6 100644
  157. --- a/activesupport/lib/active_support/buffered_logger.rb
  158. +++ b/activesupport/lib/active_support/buffered_logger.rb
  159. @@ -68,13 +68,13 @@ module ActiveSupport
  160.  
  161. for severity in Severity.constants
  162. class_eval <<-EOT, __FILE__, __LINE__
  163. - def #{severity.downcase}(message = nil, progname = nil, &block)
  164. - add(#{severity}, message, progname, &block)
  165. - end
  166. -
  167. - def #{severity.downcase}?
  168. - #{severity} >= @level
  169. - end
  170. + def #{severity.downcase}(message = nil, progname = nil, &block) # def debug(message = nil, progname = nil, &block)
  171. + add(#{severity}, message, progname, &block) # add(DEBUG, message, progname, &block)
  172. + end # end
  173. + #
  174. + def #{severity.downcase}? # def debug?
  175. + #{severity} >= @level # DEBUG >= @level
  176. + end # end
  177. EOT
  178. end
  179.  
  180. diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb
  181. index 5cdcaf5..35c4f59 100644
  182. --- a/activesupport/lib/active_support/callbacks.rb
  183. +++ b/activesupport/lib/active_support/callbacks.rb
  184. @@ -210,20 +210,20 @@ module ActiveSupport
  185. def define_callbacks(*callbacks)
  186. callbacks.each do |callback|
  187. class_eval <<-"end_eval"
  188. - def self.#{callback}(*methods, &block)
  189. - callbacks = CallbackChain.build(:#{callback}, *methods, &block)
  190. - (@#{callback}_callbacks ||= CallbackChain.new).concat callbacks
  191. - end
  192. -
  193. - def self.#{callback}_callback_chain
  194. - @#{callback}_callbacks ||= CallbackChain.new
  195. -
  196. - if superclass.respond_to?(:#{callback}_callback_chain)
  197. - CallbackChain.new(superclass.#{callback}_callback_chain + @#{callback}_callbacks)
  198. - else
  199. - @#{callback}_callbacks
  200. - end
  201. - end
  202. + def self.#{callback}(*methods, &block) # def self.before_save(*methods, &block)
  203. + callbacks = CallbackChain.build(:#{callback}, *methods, &block) # callbacks = CallbackChain.build(:before_save, *methods, &block)
  204. + (@#{callback}_callbacks ||= CallbackChain.new).concat callbacks # (@before_save_callbacks ||= CallbackChain.new).concat callbacks
  205. + end # end
  206. + #
  207. + def self.#{callback}_callback_chain # def self.before_save_callback_chain
  208. + @#{callback}_callbacks ||= CallbackChain.new # @before_save_callbacks ||= CallbackChain.new
  209. + #
  210. + if superclass.respond_to?(:#{callback}_callback_chain) # if superclass.respond_to?(:before_save_callback_chain)
  211. + CallbackChain.new(superclass.#{callback}_callback_chain + @#{callback}_callbacks) # CallbackChain.new(superclass.before_save_callback_chain + @before_save_callbacks)
  212. + else # else
  213. + @#{callback}_callbacks # @before_save_callbacks
  214. + end # end
  215. + end # end
  216. end_eval
  217. end
  218. end
  219. diff --git a/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb b/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb
  220. index 186ca69..6b40383 100644
  221. --- a/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb
  222. +++ b/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb
  223. @@ -11,17 +11,17 @@ class Class
  224. syms.flatten.each do |sym|
  225. next if sym.is_a?(Hash)
  226. class_eval(<<-EOS, __FILE__, __LINE__)
  227. - unless defined? @@#{sym}
  228. - @@#{sym} = nil
  229. - end
  230. -
  231. - def self.#{sym}
  232. - @@#{sym}
  233. - end
  234. -
  235. - def #{sym}
  236. - @@#{sym}
  237. - end
  238. + unless defined? @@#{sym} # unless defined? @@hair_colors
  239. + @@#{sym} = nil # @@hair_colors = nil
  240. + end # end
  241. + #
  242. + def self.#{sym} # def self.hair_colors
  243. + @@#{sym} # @@hair_colors
  244. + end # end
  245. + #
  246. + def #{sym} # def hair_colors
  247. + @@#{sym} # @@hair_colors
  248. + end # end
  249. EOS
  250. end
  251. end
  252. @@ -30,19 +30,19 @@ class Class
  253. options = syms.extract_options!
  254. syms.flatten.each do |sym|
  255. class_eval(<<-EOS, __FILE__, __LINE__)
  256. - unless defined? @@#{sym}
  257. - @@#{sym} = nil
  258. - end
  259. -
  260. - def self.#{sym}=(obj)
  261. - @@#{sym} = obj
  262. - end
  263. -
  264. - #{"
  265. - def #{sym}=(obj)
  266. - @@#{sym} = obj
  267. - end
  268. - " unless options[:instance_writer] == false }
  269. + unless defined? @@#{sym} # unless defined? @@hair_colors
  270. + @@#{sym} = nil # @@hair_colors = nil
  271. + end # end
  272. + #
  273. + def self.#{sym}=(obj) # def self.hair_colors=(obj)
  274. + @@#{sym} = obj # @@hair_colors = obj
  275. + end # end
  276. + #
  277. + #{" #
  278. + def #{sym}=(obj) # def hair_colors=(obj)
  279. + @@#{sym} = obj # @@hair_colors = obj
  280. + end # end
  281. + " unless options[:instance_writer] == false } # # instance writer above is generated unless options[:instance_writer] == false
  282. EOS
  283. end
  284. end
  285. diff --git a/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb b/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb
  286. index 368317d..e79e569 100644
  287. --- a/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb
  288. +++ b/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb
  289. @@ -9,22 +9,22 @@ class Class
  290. class_name_to_stop_searching_on = self.superclass.name.blank? ? "Object" : self.superclass.name
  291. names.each do |name|
  292. class_eval <<-EOS
  293. - def self.#{name}
  294. - if defined?(@#{name})
  295. - @#{name}
  296. - elsif superclass < #{class_name_to_stop_searching_on} && superclass.respond_to?(:#{name})
  297. - superclass.#{name}
  298. - end
  299. - end
  300. - def #{name}
  301. - self.class.#{name}
  302. - end
  303. - def self.#{name}?
  304. - !!#{name}
  305. - end
  306. - def #{name}?
  307. - !!#{name}
  308. - end
  309. + def self.#{name} # def self.only_reader
  310. + if defined?(@#{name}) # if defined?(@only_reader)
  311. + @#{name} # @only_reader
  312. + elsif superclass < #{class_name_to_stop_searching_on} && superclass.respond_to?(:#{name}) # elsif superclass < Object && superclass.respond_to?(:only_reader)
  313. + superclass.#{name} # superclass.only_reader
  314. + end # end
  315. + end # end
  316. + def #{name} # def only_reader
  317. + self.class.#{name} # self.class.only_reader
  318. + end # end
  319. + def self.#{name}? # def self.only_reader?
  320. + !!#{name} # !!only_reader
  321. + end # end
  322. + def #{name}? # def only_reader?
  323. + !!#{name} # !!only_reader
  324. + end # end
  325. EOS
  326. end
  327. end
  328. @@ -32,9 +32,9 @@ class Class
  329. def superclass_delegating_writer(*names)
  330. names.each do |name|
  331. class_eval <<-EOS
  332. - def self.#{name}=(value)
  333. - @#{name} = value
  334. - end
  335. + def self.#{name}=(value) # def self.only_writer=(value)
  336. + @#{name} = value # @only_writer = value
  337. + end # end
  338. EOS
  339. end
  340. end
  341. diff --git a/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb b/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
  342. index e6143a2..8b4574d 100644
  343. --- a/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
  344. +++ b/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
  345. @@ -11,13 +11,13 @@ class Class # :nodoc:
  346. syms.each do |sym|
  347. next if sym.is_a?(Hash)
  348. class_eval <<-EOS
  349. - def self.#{sym}
  350. - read_inheritable_attribute(:#{sym})
  351. - end
  352. -
  353. - def #{sym}
  354. - self.class.#{sym}
  355. - end
  356. + def self.#{sym} # def self.before_add_for_comments
  357. + read_inheritable_attribute(:#{sym}) # read_inheritable_attribute(:before_add_for_comments)
  358. + end # end
  359. + #
  360. + def #{sym} # def before_add_for_comments
  361. + self.class.#{sym} # self.class.before_add_for_comments
  362. + end # end
  363. EOS
  364. end
  365. end
  366. @@ -26,15 +26,15 @@ class Class # :nodoc:
  367. options = syms.extract_options!
  368. syms.each do |sym|
  369. class_eval <<-EOS
  370. - def self.#{sym}=(obj)
  371. - write_inheritable_attribute(:#{sym}, obj)
  372. - end
  373. -
  374. - #{"
  375. - def #{sym}=(obj)
  376. - self.class.#{sym} = obj
  377. - end
  378. - " unless options[:instance_writer] == false }
  379. + def self.#{sym}=(obj) # def self.color=(obj)
  380. + write_inheritable_attribute(:#{sym}, obj) # write_inheritable_attribute(:color, obj)
  381. + end # end
  382. + #
  383. + #{" #
  384. + def #{sym}=(obj) # def color=(obj)
  385. + self.class.#{sym} = obj # self.class.color = obj
  386. + end # end
  387. + " unless options[:instance_writer] == false } # # the writer above is generated unless options[:instance_writer] == false
  388. EOS
  389. end
  390. end
  391. @@ -43,15 +43,15 @@ class Class # :nodoc:
  392. options = syms.extract_options!
  393. syms.each do |sym|
  394. class_eval <<-EOS
  395. - def self.#{sym}=(obj)
  396. - write_inheritable_array(:#{sym}, obj)
  397. - end
  398. -
  399. - #{"
  400. - def #{sym}=(obj)
  401. - self.class.#{sym} = obj
  402. - end
  403. - " unless options[:instance_writer] == false }
  404. + def self.#{sym}=(obj) # def self.levels=(obj)
  405. + write_inheritable_array(:#{sym}, obj) # write_inheritable_array(:levels, obj)
  406. + end # end
  407. + #
  408. + #{" #
  409. + def #{sym}=(obj) # def levels=(obj)
  410. + self.class.#{sym} = obj # self.class.levels = obj
  411. + end # end
  412. + " unless options[:instance_writer] == false } # # the writer above is generated unless options[:instance_writer] == false
  413. EOS
  414. end
  415. end
  416. @@ -60,15 +60,15 @@ class Class # :nodoc:
  417. options = syms.extract_options!
  418. syms.each do |sym|
  419. class_eval <<-EOS
  420. - def self.#{sym}=(obj)
  421. - write_inheritable_hash(:#{sym}, obj)
  422. - end
  423. -
  424. - #{"
  425. - def #{sym}=(obj)
  426. - self.class.#{sym} = obj
  427. - end
  428. - " unless options[:instance_writer] == false }
  429. + def self.#{sym}=(obj) # def self.nicknames=(obj)
  430. + write_inheritable_hash(:#{sym}, obj) # write_inheritable_hash(:nicknames, obj)
  431. + end # end
  432. + #
  433. + #{" #
  434. + def #{sym}=(obj) # def nicknames=(obj)
  435. + self.class.#{sym} = obj # self.class.nicknames = obj
  436. + end # end
  437. + " unless options[:instance_writer] == false } # # the writer above is generated unless options[:instance_writer] == false
  438. EOS
  439. end
  440. end
  441. diff --git a/activesupport/lib/active_support/core_ext/logger.rb b/activesupport/lib/active_support/core_ext/logger.rb
  442. index 24fe729..c7919a1 100644
  443. --- a/activesupport/lib/active_support/core_ext/logger.rb
  444. +++ b/activesupport/lib/active_support/core_ext/logger.rb
  445. @@ -3,12 +3,12 @@
  446. class Logger
  447. def self.define_around_helper(level)
  448. module_eval <<-end_eval
  449. - def around_#{level}(before_message, after_message, &block)
  450. - self.#{level}(before_message)
  451. - return_value = block.call(self)
  452. - self.#{level}(after_message)
  453. - return return_value
  454. - end
  455. + def around_#{level}(before_message, after_message, &block) # def around_debug(before_message, after_message, &block)
  456. + self.#{level}(before_message) # self.debug(before_message)
  457. + return_value = block.call(self) # return_value = block.call(self)
  458. + self.#{level}(after_message) # self.debug(after_message)
  459. + return return_value # return return_value
  460. + end # end
  461. end_eval
  462. end
  463. [:debug, :info, :error, :fatal].each {|level| define_around_helper(level) }
  464. diff --git a/activesupport/lib/active_support/core_ext/module/aliasing.rb b/activesupport/lib/active_support/core_ext/module/aliasing.rb
  465. index e640f64..b6f66b2 100644
  466. --- a/activesupport/lib/active_support/core_ext/module/aliasing.rb
  467. +++ b/activesupport/lib/active_support/core_ext/module/aliasing.rb
  468. @@ -64,9 +64,9 @@ module ActiveSupport
  469. # e.title # => "Megastars"
  470. def alias_attribute(new_name, old_name)
  471. module_eval <<-STR, __FILE__, __LINE__+1
  472. - def #{new_name}; self.#{old_name}; end
  473. - def #{new_name}?; self.#{old_name}?; end
  474. - def #{new_name}=(v); self.#{old_name} = v; end
  475. + def #{new_name}; self.#{old_name}; end # def subject; self.title; end
  476. + def #{new_name}?; self.#{old_name}?; end # def subject?; self.title?; end
  477. + def #{new_name}=(v); self.#{old_name} = v; end # def subject=(v); self.title = v; end
  478. STR
  479. end
  480. end
  481. diff --git a/activesupport/lib/active_support/core_ext/module/attr_accessor_with_default.rb b/activesupport/lib/active_support/core_ext/module/attr_accessor_with_default.rb
  482. index 683789d..b0c93ac 100644
  483. --- a/activesupport/lib/active_support/core_ext/module/attr_accessor_with_default.rb
  484. +++ b/activesupport/lib/active_support/core_ext/module/attr_accessor_with_default.rb
  485. @@ -22,10 +22,10 @@ class Module
  486. raise 'Default value or block required' unless !default.nil? || block
  487. define_method(sym, block_given? ? block : Proc.new { default })
  488. module_eval(<<-EVAL, __FILE__, __LINE__)
  489. - def #{sym}=(value)
  490. - class << self; attr_reader :#{sym} end
  491. - @#{sym} = value
  492. - end
  493. + def #{sym}=(value) # def age=(value)
  494. + class << self; attr_reader :#{sym} end # class << self; attr_reader :age end
  495. + @#{sym} = value # @age = value
  496. + end # end
  497. EVAL
  498. end
  499. end
  500. diff --git a/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb b/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb
  501. index 51e1c9a..56e967a 100644
  502. --- a/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb
  503. +++ b/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb
  504. @@ -15,17 +15,17 @@ class Module
  505. syms.each do |sym|
  506. next if sym.is_a?(Hash)
  507. class_eval(<<-EOS, __FILE__, __LINE__)
  508. - unless defined? @@#{sym}
  509. - @@#{sym} = nil
  510. - end
  511. -
  512. - def self.#{sym}
  513. - @@#{sym}
  514. - end
  515. -
  516. - def #{sym}
  517. - @@#{sym}
  518. - end
  519. + unless defined? @@#{sym} # unless defined? @@pagination_options
  520. + @@#{sym} = nil # @@pagination_options = nil
  521. + end # end
  522. + #
  523. + def self.#{sym} # def self.pagination_options
  524. + @@#{sym} # @@pagination_options
  525. + end # end
  526. + #
  527. + def #{sym} # def pagination_options
  528. + @@#{sym} # @@pagination_options
  529. + end # end
  530. EOS
  531. end
  532. end
  533. @@ -34,19 +34,19 @@ class Module
  534. options = syms.extract_options!
  535. syms.each do |sym|
  536. class_eval(<<-EOS, __FILE__, __LINE__)
  537. - unless defined? @@#{sym}
  538. - @@#{sym} = nil
  539. - end
  540. -
  541. - def self.#{sym}=(obj)
  542. - @@#{sym} = obj
  543. - end
  544. -
  545. - #{"
  546. - def #{sym}=(obj)
  547. - @@#{sym} = obj
  548. - end
  549. - " unless options[:instance_writer] == false }
  550. + unless defined? @@#{sym} # unless defined? @@pagination_options
  551. + @@#{sym} = nil # @@pagination_options = nil
  552. + end # end
  553. + #
  554. + def self.#{sym}=(obj) # def self.pagination_options=(obj)
  555. + @@#{sym} = obj # @@pagination_options = obj
  556. + end # end
  557. + #
  558. + #{" #
  559. + def #{sym}=(obj) # def pagination_options=(obj)
  560. + @@#{sym} = obj # @@pagination_options = obj
  561. + end # end
  562. + " unless options[:instance_writer] == false } # # instance writer above is generated unless options[:instance_writer] == false
  563. EOS
  564. end
  565. end
  566. diff --git a/activesupport/lib/active_support/core_ext/module/delegation.rb b/activesupport/lib/active_support/core_ext/module/delegation.rb
  567. index 5c75bd4..b1cd9a8 100644
  568. --- a/activesupport/lib/active_support/core_ext/module/delegation.rb
  569. +++ b/activesupport/lib/active_support/core_ext/module/delegation.rb
  570. @@ -112,9 +112,9 @@ class Module
  571.  
  572. methods.each do |method|
  573. module_eval(<<-EOS, "(__DELEGATION__)", 1)
  574. - def #{prefix}#{method}(*args, &block)
  575. - #{allow_nil}#{to}.__send__(#{method.inspect}, *args, &block)
  576. - end
  577. + def #{prefix}#{method}(*args, &block) # def customer_name(*args, &block)
  578. + #{allow_nil}#{to}.__send__(#{method.inspect}, *args, &block) # client && client.__send__(:name, *args, &block)
  579. + end # end
  580. EOS
  581. end
  582. end
  583. diff --git a/activesupport/lib/active_support/core_ext/module/synchronization.rb b/activesupport/lib/active_support/core_ext/module/synchronization.rb
  584. index 2516060..ffcd068 100644
  585. --- a/activesupport/lib/active_support/core_ext/module/synchronization.rb
  586. +++ b/activesupport/lib/active_support/core_ext/module/synchronization.rb
  587. @@ -26,11 +26,11 @@ class Module
  588. end
  589.  
  590. module_eval(<<-EOS, __FILE__, __LINE__)
  591. - def #{aliased_method}_with_synchronization#{punctuation}(*args, &block)
  592. - #{with}.synchronize do
  593. - #{aliased_method}_without_synchronization#{punctuation}(*args, &block)
  594. - end
  595. - end
  596. + def #{aliased_method}_with_synchronization#{punctuation}(*args, &block) # def expire_with_synchronization(*args, &block)
  597. + #{with}.synchronize do # @@lock.synchronize do
  598. + #{aliased_method}_without_synchronization#{punctuation}(*args, &block) # expire_without_synchronization(*args, &block)
  599. + end # end
  600. + end # end
  601. EOS
  602.  
  603. alias_method_chain method, :synchronization
  604. diff --git a/activesupport/lib/active_support/memoizable.rb b/activesupport/lib/active_support/memoizable.rb
  605. index 9f2fd3a..9181173 100644
  606. --- a/activesupport/lib/active_support/memoizable.rb
  607. +++ b/activesupport/lib/active_support/memoizable.rb
  608. @@ -59,34 +59,34 @@ module ActiveSupport
  609. memoized_ivar = ActiveSupport::Memoizable.memoized_ivar_for(symbol)
  610.  
  611. class_eval <<-EOS, __FILE__, __LINE__
  612. - include InstanceMethods
  613. -
  614. - raise "Already memoized #{symbol}" if method_defined?(:#{original_method})
  615. - alias #{original_method} #{symbol}
  616. -
  617. - if instance_method(:#{symbol}).arity == 0
  618. - def #{symbol}(reload = false)
  619. - if reload || !defined?(#{memoized_ivar}) || #{memoized_ivar}.empty?
  620. - #{memoized_ivar} = [#{original_method}.freeze]
  621. - end
  622. - #{memoized_ivar}[0]
  623. - end
  624. - else
  625. - def #{symbol}(*args)
  626. - #{memoized_ivar} ||= {} unless frozen?
  627. - reload = args.pop if args.last == true || args.last == :reload
  628. -
  629. - if defined?(#{memoized_ivar}) && #{memoized_ivar}
  630. - if !reload && #{memoized_ivar}.has_key?(args)
  631. - #{memoized_ivar}[args]
  632. - elsif #{memoized_ivar}
  633. - #{memoized_ivar}[args] = #{original_method}(*args).freeze
  634. - end
  635. - else
  636. - #{original_method}(*args)
  637. - end
  638. - end
  639. - end
  640. + include InstanceMethods # include InstanceMethods
  641. + #
  642. + raise "Already memoized #{symbol}" if method_defined?(:#{original_method}) # raise "Already memoized mime_type" if method_defined?(:_unmemoized_mime_type)
  643. + alias #{original_method} #{symbol} # alias _unmemoized_mime_type mime_type
  644. + #
  645. + if instance_method(:#{symbol}).arity == 0 # if instance_method(:mime_type).arity == 0
  646. + def #{symbol}(reload = false) # def mime_type(reload = false)
  647. + if reload || !defined?(#{memoized_ivar}) || #{memoized_ivar}.empty? # if reload || !defined?(@_memoized_mime_type) || @_memoized_mime_type.empty?
  648. + #{memoized_ivar} = [#{original_method}.freeze] # @_memoized_mime_type = [_unmemoized_mime_type.freeze]
  649. + end # end
  650. + #{memoized_ivar}[0] # @_memoized_mime_type[0]
  651. + end # end
  652. + else # else
  653. + def #{symbol}(*args) # def mime_type(*args)
  654. + #{memoized_ivar} ||= {} unless frozen? # @_memoized_mime_type ||= {} unless frozen?
  655. + reload = args.pop if args.last == true || args.last == :reload # reload = args.pop if args.last == true || args.last == :reload
  656. + #
  657. + if defined?(#{memoized_ivar}) && #{memoized_ivar} # if defined?(@_memoized_mime_type) && @_memoized_mime_type
  658. + if !reload && #{memoized_ivar}.has_key?(args) # if !reload && @_memoized_mime_type.has_key?(args)
  659. + #{memoized_ivar}[args] # @_memoized_mime_type[args]
  660. + elsif #{memoized_ivar} # elsif @_memoized_mime_type
  661. + #{memoized_ivar}[args] = #{original_method}(*args).freeze # @_memoized_mime_type[args] = _unmemoized_mime_type(*args).freeze
  662. + end # end
  663. + else # else
  664. + #{original_method}(*args) # _unmemoized_mime_type(*args)
  665. + end # end
  666. + end # end
  667. + end # end
  668. EOS
  669. end
  670. end
  671. diff --git a/activesupport/lib/active_support/multibyte/unicode_database.rb b/activesupport/lib/active_support/multibyte/unicode_database.rb
  672. index 3b8cf8f..138575f 100644
  673. --- a/activesupport/lib/active_support/multibyte/unicode_database.rb
  674. +++ b/activesupport/lib/active_support/multibyte/unicode_database.rb
  675. @@ -24,10 +24,10 @@ module ActiveSupport #:nodoc:
  676. # Lazy load the Unicode database so it's only loaded when it's actually used
  677. ATTRIBUTES.each do |attr_name|
  678. class_eval(<<-EOS, __FILE__, __LINE__)
  679. - def #{attr_name}
  680. - load
  681. - @#{attr_name}
  682. - end
  683. + def #{attr_name} # def codepoints
  684. + load # load
  685. + @#{attr_name} # @codepoints
  686. + end # end
  687. EOS
  688. end
  689.  
  690. diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb
  691. index 9a2d283..6f936e9 100644
  692. --- a/activesupport/lib/active_support/time_with_zone.rb
  693. +++ b/activesupport/lib/active_support/time_with_zone.rb
  694. @@ -234,9 +234,9 @@ module ActiveSupport
  695.  
  696. %w(year mon month day mday wday yday hour min sec to_date).each do |method_name|
  697. class_eval <<-EOV
  698. - def #{method_name}
  699. - time.#{method_name}
  700. - end
  701. + def #{method_name} # def year
  702. + time.#{method_name} # time.year
  703. + end # end
  704. EOV
  705. end
Add Comment
Please, Sign In to add comment