From fa6d921e11363e9b8c4bc10f7aed0b9faffdc33a Mon Sep 17 00:00:00 2001 From: Henrik Hodne Date: Sun, 20 May 2012 01:29:13 +0200 Subject: Remove blank trailing comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For future reference, this is the regex I used: ^\s*#\s*\n(?!\s*#). Replace with the first match, and voilà! Note that the regex matches a little bit too much, so you probably want to `git add -i .` and go through every single diff to check if it actually should be changed. --- activesupport/lib/active_support/benchmarkable.rb | 1 - activesupport/lib/active_support/callbacks.rb | 1 - activesupport/lib/active_support/concern.rb | 1 - activesupport/lib/active_support/configurable.rb | 2 -- activesupport/lib/active_support/core_ext/array/conversions.rb | 1 - activesupport/lib/active_support/core_ext/array/uniq_by.rb | 1 - activesupport/lib/active_support/core_ext/enumerable.rb | 2 -- activesupport/lib/active_support/core_ext/hash/except.rb | 1 - .../lib/active_support/core_ext/hash/indifferent_access.rb | 2 -- activesupport/lib/active_support/core_ext/integer/inflections.rb | 2 -- activesupport/lib/active_support/core_ext/kernel/reporting.rb | 2 -- activesupport/lib/active_support/core_ext/module/anonymous.rb | 1 - activesupport/lib/active_support/core_ext/module/delegation.rb | 1 - activesupport/lib/active_support/core_ext/module/introspection.rb | 2 -- activesupport/lib/active_support/core_ext/object/blank.rb | 7 ------- activesupport/lib/active_support/core_ext/object/duplicable.rb | 5 ----- activesupport/lib/active_support/core_ext/object/with_options.rb | 1 - activesupport/lib/active_support/core_ext/string/inflections.rb | 1 - activesupport/lib/active_support/core_ext/string/output_safety.rb | 1 - activesupport/lib/active_support/file_update_checker.rb | 1 - activesupport/lib/active_support/hash_with_indifferent_access.rb | 4 ---- activesupport/lib/active_support/inflector/methods.rb | 1 - activesupport/lib/active_support/lazy_load_hooks.rb | 1 - activesupport/lib/active_support/log_subscriber.rb | 1 - activesupport/lib/active_support/log_subscriber/test_helper.rb | 2 -- activesupport/lib/active_support/message_encryptor.rb | 1 - activesupport/lib/active_support/notifications.rb | 1 - activesupport/lib/active_support/ordered_options.rb | 1 - activesupport/lib/active_support/string_inquirer.rb | 1 - activesupport/lib/active_support/time_with_zone.rb | 2 -- 30 files changed, 51 deletions(-) (limited to 'activesupport/lib/active_support') diff --git a/activesupport/lib/active_support/benchmarkable.rb b/activesupport/lib/active_support/benchmarkable.rb index f149a7f0ed..a39fa016ec 100644 --- a/activesupport/lib/active_support/benchmarkable.rb +++ b/activesupport/lib/active_support/benchmarkable.rb @@ -44,7 +44,6 @@ module ActiveSupport end # Silence the logger during the execution of the block. - # def silence old_logger_level, logger.level = logger.level, ::Logger::ERROR if logger yield diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index a9253c186d..9636bbccb5 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -341,7 +341,6 @@ module ActiveSupport # This is used internally to append, prepend and skip callbacks to the # CallbackChain. - # def __update_callbacks(name, filters = [], block = nil) #:nodoc: type = filters.first.in?([:before, :after, :around]) ? filters.shift : :before options = filters.last.is_a?(Hash) ? filters.pop : {} diff --git a/activesupport/lib/active_support/concern.rb b/activesupport/lib/active_support/concern.rb index c94a8d99f4..9450d4ea88 100644 --- a/activesupport/lib/active_support/concern.rb +++ b/activesupport/lib/active_support/concern.rb @@ -94,7 +94,6 @@ module ActiveSupport # class Host # include Bar # works, Bar takes care now of its dependencies # end - # module Concern def self.extended(base) base.instance_variable_set("@_dependencies", []) diff --git a/activesupport/lib/active_support/configurable.rb b/activesupport/lib/active_support/configurable.rb index a8aa53a80f..afd56cb7ce 100644 --- a/activesupport/lib/active_support/configurable.rb +++ b/activesupport/lib/active_support/configurable.rb @@ -48,7 +48,6 @@ module ActiveSupport # user = User.new # user.allowed_access = true # user.allowed_access # => true - # def config_accessor(*names) options = names.extract_options! @@ -79,7 +78,6 @@ module ActiveSupport # # user.config.allowed_access # => true # user.config.level # => 1 - # def config @_config ||= self.class.config.inheritable_copy end diff --git a/activesupport/lib/active_support/core_ext/array/conversions.rb b/activesupport/lib/active_support/core_ext/array/conversions.rb index 24aa28b895..193388a158 100644 --- a/activesupport/lib/active_support/core_ext/array/conversions.rb +++ b/activesupport/lib/active_support/core_ext/array/conversions.rb @@ -136,7 +136,6 @@ class Array # 1 # # - # def to_xml(options = {}) require 'active_support/builder' unless defined?(Builder) diff --git a/activesupport/lib/active_support/core_ext/array/uniq_by.rb b/activesupport/lib/active_support/core_ext/array/uniq_by.rb index 3bedfa9a61..c1d5a355a4 100644 --- a/activesupport/lib/active_support/core_ext/array/uniq_by.rb +++ b/activesupport/lib/active_support/core_ext/array/uniq_by.rb @@ -4,7 +4,6 @@ class Array # Returns a unique array based on the criteria in the block. # # [1, 2, 3, 4].uniq_by { |i| i.odd? } # => [1, 2] - # def uniq_by(&block) ActiveSupport::Deprecation.warn 'uniq_by is deprecated. Use Array#uniq instead', caller uniq(&block) diff --git a/activesupport/lib/active_support/core_ext/enumerable.rb b/activesupport/lib/active_support/core_ext/enumerable.rb index 02d5a7080f..b950826396 100644 --- a/activesupport/lib/active_support/core_ext/enumerable.rb +++ b/activesupport/lib/active_support/core_ext/enumerable.rb @@ -17,7 +17,6 @@ module Enumerable # The default sum of an empty list is zero. You can override this default: # # [].sum(Payment.new(0)) { |i| i.amount } # => Payment.new(0) - # def sum(identity = 0, &block) if block_given? map(&block).sum(identity) @@ -32,7 +31,6 @@ module Enumerable # => { "nextangle" => , "chade-" => , ...} # people.index_by { |person| "#{person.first_name} #{person.last_name}" } # => { "Chade- Fowlersburg-e" => , "David Heinemeier Hansson" => , ...} - # def index_by if block_given? Hash[map { |elem| [yield(elem), elem] }] diff --git a/activesupport/lib/active_support/core_ext/hash/except.rb b/activesupport/lib/active_support/core_ext/hash/except.rb index 5a61906222..fafd4919b9 100644 --- a/activesupport/lib/active_support/core_ext/hash/except.rb +++ b/activesupport/lib/active_support/core_ext/hash/except.rb @@ -10,7 +10,6 @@ class Hash # # {:a => 1}.with_indifferent_access.except(:a) # => {} # {:a => 1}.with_indifferent_access.except('a') # => {} - # def except(*keys) dup.except!(*keys) end diff --git a/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb b/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb index 7d54c9fae6..c1f368d0eb 100644 --- a/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb +++ b/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb @@ -5,7 +5,6 @@ class Hash # Returns an ActiveSupport::HashWithIndifferentAccess out of its receiver: # # {:a => 1}.with_indifferent_access["a"] # => 1 - # def with_indifferent_access ActiveSupport::HashWithIndifferentAccess.new_from_hash_copying_default(self) end @@ -19,6 +18,5 @@ class Hash # # b = {:b => 1} # {:a => b}.with_indifferent_access["a"] # calls b.nested_under_indifferent_access - # alias nested_under_indifferent_access with_indifferent_access end diff --git a/activesupport/lib/active_support/core_ext/integer/inflections.rb b/activesupport/lib/active_support/core_ext/integer/inflections.rb index 1e30687166..56f2ed5985 100644 --- a/activesupport/lib/active_support/core_ext/integer/inflections.rb +++ b/activesupport/lib/active_support/core_ext/integer/inflections.rb @@ -10,7 +10,6 @@ class Integer # 1003.ordinalize # => "1003rd" # -11.ordinalize # => "-11th" # -1001.ordinalize # => "-1001st" - # def ordinalize ActiveSupport::Inflector.ordinalize(self) end @@ -24,7 +23,6 @@ class Integer # 1003.ordinal # => "rd" # -11.ordinal # => "th" # -1001.ordinal # => "st" - # def ordinal ActiveSupport::Inflector.ordinal(self) end diff --git a/activesupport/lib/active_support/core_ext/kernel/reporting.rb b/activesupport/lib/active_support/core_ext/kernel/reporting.rb index ad3f9ebec9..728069a9a8 100644 --- a/activesupport/lib/active_support/core_ext/kernel/reporting.rb +++ b/activesupport/lib/active_support/core_ext/kernel/reporting.rb @@ -65,7 +65,6 @@ module Kernel # # stream = capture(:stdout) { puts 'Cool' } # stream # => "Cool\n" - # def capture(stream) begin stream = stream.to_s @@ -83,7 +82,6 @@ module Kernel # Silences both STDOUT and STDERR, even for subprocesses. # # quietly { system 'bundle install' } - # def quietly silence_stream(STDOUT) do silence_stream(STDERR) do diff --git a/activesupport/lib/active_support/core_ext/module/anonymous.rb b/activesupport/lib/active_support/core_ext/module/anonymous.rb index 0a9e791030..b0c7b021db 100644 --- a/activesupport/lib/active_support/core_ext/module/anonymous.rb +++ b/activesupport/lib/active_support/core_ext/module/anonymous.rb @@ -13,7 +13,6 @@ class Module # m = Module.new # creates an anonymous module # M = m # => m gets a name here as a side-effect # m.name # => "M" - # def anonymous? name.nil? end diff --git a/activesupport/lib/active_support/core_ext/module/delegation.rb b/activesupport/lib/active_support/core_ext/module/delegation.rb index fbef27c76a..30acc87c4a 100644 --- a/activesupport/lib/active_support/core_ext/module/delegation.rb +++ b/activesupport/lib/active_support/core_ext/module/delegation.rb @@ -100,7 +100,6 @@ class Module # end # # Foo.new.zoo # returns nil - # def delegate(*methods) options = methods.pop unless options.is_a?(Hash) && to = options[:to] diff --git a/activesupport/lib/active_support/core_ext/module/introspection.rb b/activesupport/lib/active_support/core_ext/module/introspection.rb index 3c8e811fa4..649a969149 100644 --- a/activesupport/lib/active_support/core_ext/module/introspection.rb +++ b/activesupport/lib/active_support/core_ext/module/introspection.rb @@ -27,7 +27,6 @@ class Module # # M.parent # => Object # Module.new.parent # => Object - # def parent parent_name ? ActiveSupport::Inflector.constantize(parent_name) : Object end @@ -44,7 +43,6 @@ class Module # M.parents # => [Object] # M::N.parents # => [M, Object] # X.parents # => [M, Object] - # def parents parents = [] if parent_name diff --git a/activesupport/lib/active_support/core_ext/object/blank.rb b/activesupport/lib/active_support/core_ext/object/blank.rb index e238fef5a2..09d9af1bde 100644 --- a/activesupport/lib/active_support/core_ext/object/blank.rb +++ b/activesupport/lib/active_support/core_ext/object/blank.rb @@ -43,7 +43,6 @@ class NilClass # +nil+ is blank: # # nil.blank? # => true - # def blank? true end @@ -53,7 +52,6 @@ class FalseClass # +false+ is blank: # # false.blank? # => true - # def blank? true end @@ -63,7 +61,6 @@ class TrueClass # +true+ is not blank: # # true.blank? # => false - # def blank? false end @@ -74,7 +71,6 @@ class Array # # [].blank? # => true # [1,2,3].blank? # => false - # alias_method :blank?, :empty? end @@ -83,7 +79,6 @@ class Hash # # {}.blank? # => true # {:key => 'value'}.blank? # => false - # alias_method :blank?, :empty? end @@ -94,7 +89,6 @@ class String # ' '.blank? # => true # ' '.blank? # => true # ' something here '.blank? # => false - # def blank? self !~ /[^[:space:]]/ end @@ -105,7 +99,6 @@ class Numeric #:nodoc: # # 1.blank? # => false # 0.blank? # => false - # def blank? false end diff --git a/activesupport/lib/active_support/core_ext/object/duplicable.rb b/activesupport/lib/active_support/core_ext/object/duplicable.rb index f1b755c2c4..9cd7485e2e 100644 --- a/activesupport/lib/active_support/core_ext/object/duplicable.rb +++ b/activesupport/lib/active_support/core_ext/object/duplicable.rb @@ -31,7 +31,6 @@ class NilClass # # nil.duplicable? # => false # nil.dup # => TypeError: can't dup NilClass - # def duplicable? false end @@ -42,7 +41,6 @@ class FalseClass # # false.duplicable? # => false # false.dup # => TypeError: can't dup FalseClass - # def duplicable? false end @@ -53,7 +51,6 @@ class TrueClass # # true.duplicable? # => false # true.dup # => TypeError: can't dup TrueClass - # def duplicable? false end @@ -64,7 +61,6 @@ class Symbol # # :my_symbol.duplicable? # => false # :my_symbol.dup # => TypeError: can't dup Symbol - # def duplicable? false end @@ -75,7 +71,6 @@ class Numeric # # 3.duplicable? # => false # 3.dup # => TypeError: can't dup Fixnum - # def duplicable? false end diff --git a/activesupport/lib/active_support/core_ext/object/with_options.rb b/activesupport/lib/active_support/core_ext/object/with_options.rb index e058367111..723bf69189 100644 --- a/activesupport/lib/active_support/core_ext/object/with_options.rb +++ b/activesupport/lib/active_support/core_ext/object/with_options.rb @@ -36,7 +36,6 @@ class Object # # with_options can also be nested since the call is forwarded to its receiver. # Each nesting level will merge inherited defaults in addition to their own. - # def with_options(options) yield ActiveSupport::OptionMerger.new(self, options) end diff --git a/activesupport/lib/active_support/core_ext/string/inflections.rb b/activesupport/lib/active_support/core_ext/string/inflections.rb index 070bfd7af6..e726a475e0 100644 --- a/activesupport/lib/active_support/core_ext/string/inflections.rb +++ b/activesupport/lib/active_support/core_ext/string/inflections.rb @@ -5,7 +5,6 @@ require 'active_support/inflector/transliterate' # For instance, you can figure out the name of a table from the name of a class. # # 'ScaleScore'.tableize # => "scale_scores" -# class String # Returns the plural form of the word in the string. # diff --git a/activesupport/lib/active_support/core_ext/string/output_safety.rb b/activesupport/lib/active_support/core_ext/string/output_safety.rb index 5226ff0cbe..d4e1597840 100644 --- a/activesupport/lib/active_support/core_ext/string/output_safety.rb +++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb @@ -64,7 +64,6 @@ class ERB # in Rails templates: # # <%=j @person.to_json %> - # def json_escape(s) result = s.to_s.gsub(JSON_ESCAPE_REGEXP) { |special| JSON_ESCAPE[special] } s.html_safe? ? result.html_safe : result diff --git a/activesupport/lib/active_support/file_update_checker.rb b/activesupport/lib/active_support/file_update_checker.rb index 8860636168..20dde73abf 100644 --- a/activesupport/lib/active_support/file_update_checker.rb +++ b/activesupport/lib/active_support/file_update_checker.rb @@ -28,7 +28,6 @@ module ActiveSupport # ActionDispatch::Reloader.to_prepare do # i18n_reloader.execute_if_updated # end - # class FileUpdateChecker # It accepts two parameters on initialization. The first is an array # of files and the second is an optional hash of directories. The hash must diff --git a/activesupport/lib/active_support/hash_with_indifferent_access.rb b/activesupport/lib/active_support/hash_with_indifferent_access.rb index 91459f3e5b..3191a3bdc6 100644 --- a/activesupport/lib/active_support/hash_with_indifferent_access.rb +++ b/activesupport/lib/active_support/hash_with_indifferent_access.rb @@ -53,7 +53,6 @@ module ActiveSupport # # hash = HashWithIndifferentAccess.new # hash[:key] = "value" - # def []=(key, value) regular_writer(convert_key(key), convert_value(value)) end @@ -69,7 +68,6 @@ module ActiveSupport # hash_2[:key] = "New Value!" # # hash_1.update(hash_2) # => {"key"=>"New Value!"} - # def update(other_hash) if other_hash.is_a? HashWithIndifferentAccess super(other_hash) @@ -87,7 +85,6 @@ module ActiveSupport # hash["key"] = "value" # hash.key? :key # => true # hash.key? "key" # => true - # def key?(key) super(convert_key(key)) end @@ -107,7 +104,6 @@ module ActiveSupport # hash[:a] = "x" # hash[:b] = "y" # hash.values_at("a", "b") # => ["x", "y"] - # def values_at(*indices) indices.collect {|key| self[convert_key(key)]} end diff --git a/activesupport/lib/active_support/inflector/methods.rb b/activesupport/lib/active_support/inflector/methods.rb index 48296841aa..53a1c3f160 100644 --- a/activesupport/lib/active_support/inflector/methods.rb +++ b/activesupport/lib/active_support/inflector/methods.rb @@ -228,7 +228,6 @@ module ActiveSupport # "blargle".safe_constantize # => nil # "UnknownModule".safe_constantize # => nil # "UnknownModule::Foo::Bar".safe_constantize # => nil - # def safe_constantize(camel_cased_word) begin constantize(camel_cased_word) diff --git a/activesupport/lib/active_support/lazy_load_hooks.rb b/activesupport/lib/active_support/lazy_load_hooks.rb index c167efc1a7..34450c65d4 100644 --- a/activesupport/lib/active_support/lazy_load_hooks.rb +++ b/activesupport/lib/active_support/lazy_load_hooks.rb @@ -17,7 +17,6 @@ module ActiveSupport # The very last line of +activerecord/lib/active_record/base.rb+ is: # # ActiveSupport.run_load_hooks(:active_record, ActiveRecord::Base) - # @load_hooks = Hash.new { |h,k| h[k] = [] } @loaded = Hash.new { |h,k| h[k] = [] } diff --git a/activesupport/lib/active_support/log_subscriber.rb b/activesupport/lib/active_support/log_subscriber.rb index d2a6e1bd82..20ca6ff5f6 100644 --- a/activesupport/lib/active_support/log_subscriber.rb +++ b/activesupport/lib/active_support/log_subscriber.rb @@ -111,7 +111,6 @@ module ActiveSupport # option is set to true, it also adds bold to the string. This is based # on the Highline implementation and will automatically append CLEAR to the # end of the returned String. - # def color(text, color, bold=false) return text unless colorize_logging color = self.class.const_get(color.to_s.upcase) if color.is_a?(Symbol) diff --git a/activesupport/lib/active_support/log_subscriber/test_helper.rb b/activesupport/lib/active_support/log_subscriber/test_helper.rb index b65ea6208c..5c7a238934 100644 --- a/activesupport/lib/active_support/log_subscriber/test_helper.rb +++ b/activesupport/lib/active_support/log_subscriber/test_helper.rb @@ -31,7 +31,6 @@ module ActiveSupport # powers (it actually does not send anything to your output), and you can collect them # doing @logger.logged(level), where level is the level used in logging, like info, # debug, warn and so on. - # module TestHelper def setup @logger = MockLogger.new @@ -96,7 +95,6 @@ module ActiveSupport # def logger # ActiveRecord::Base.logger = @logger # end - # def set_logger(logger) ActiveSupport::LogSubscriber.logger = logger end diff --git a/activesupport/lib/active_support/message_encryptor.rb b/activesupport/lib/active_support/message_encryptor.rb index ada2e79ccb..c002b1c02c 100644 --- a/activesupport/lib/active_support/message_encryptor.rb +++ b/activesupport/lib/active_support/message_encryptor.rb @@ -36,7 +36,6 @@ module ActiveSupport # Options: # * :cipher - Cipher to use. Can be any cipher returned by OpenSSL::Cipher.ciphers. Default is 'aes-256-cbc' # * :serializer - Object serializer to use. Default is +Marshal+. - # def initialize(secret, options = {}) @secret = secret @cipher = options[:cipher] || 'aes-256-cbc' diff --git a/activesupport/lib/active_support/notifications.rb b/activesupport/lib/active_support/notifications.rb index 6735c561d3..6d89307638 100644 --- a/activesupport/lib/active_support/notifications.rb +++ b/activesupport/lib/active_support/notifications.rb @@ -133,7 +133,6 @@ module ActiveSupport # # Notifications ships with a queue implementation that consumes and publish events # to log subscribers in a thread. You can use any queue implementation you want. - # module Notifications @instrumenters = Hash.new { |h,k| h[k] = notifier.listening?(k) } diff --git a/activesupport/lib/active_support/ordered_options.rb b/activesupport/lib/active_support/ordered_options.rb index 60e6cd55ad..6bd6f1f2ff 100644 --- a/activesupport/lib/active_support/ordered_options.rb +++ b/activesupport/lib/active_support/ordered_options.rb @@ -13,7 +13,6 @@ # h.girl = 'Mary' # h.boy # => 'John' # h.girl # => 'Mary' -# module ActiveSupport #:nodoc: class OrderedOptions < Hash alias_method :_get, :[] # preserve the original #[] method diff --git a/activesupport/lib/active_support/string_inquirer.rb b/activesupport/lib/active_support/string_inquirer.rb index f3f3909a90..e059594bfa 100644 --- a/activesupport/lib/active_support/string_inquirer.rb +++ b/activesupport/lib/active_support/string_inquirer.rb @@ -8,7 +8,6 @@ module ActiveSupport # you can call this: # # Rails.env.production? - # class StringInquirer < String def method_missing(method_name, *arguments) if method_name[-1, 1] == "?" diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb index 451520ac5c..f040ee7101 100644 --- a/activesupport/lib/active_support/time_with_zone.rb +++ b/activesupport/lib/active_support/time_with_zone.rb @@ -31,7 +31,6 @@ module ActiveSupport # t > Time.utc(1999) # => true # t.is_a?(Time) # => true # t.is_a?(ActiveSupport::TimeWithZone) # => true - # class TimeWithZone # Report class name as 'Time' to thwart type checking @@ -127,7 +126,6 @@ module ActiveSupport # # With ActiveSupport::JSON::Encoding.use_standard_json_time_format = false # Time.utc(2005,2,1,15,15,10).in_time_zone.to_json # # => "2005/02/01 15:15:10 +0000" - # def as_json(options = nil) if ActiveSupport::JSON::Encoding.use_standard_json_time_format xmlschema -- cgit v1.2.3