Skip to content
Browse files

Remove blank trailing comments

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.
  • Loading branch information...
1 parent 7eb09ae commit fa6d921e11363e9b8c4bc10f7aed0b9faffdc33a @henrikhodne henrikhodne committed May 20, 2012
Showing with 0 additions and 192 deletions.
  1. +0 −1 Rakefile
  2. +0 −1 actionmailer/lib/action_mailer/delivery_methods.rb
  3. +0 −1 actionmailer/lib/rails/generators/mailer/templates/mailer.rb
  4. +0 −1 actionpack/lib/abstract_controller/helpers.rb
  5. +0 −1 actionpack/lib/action_controller/base.rb
  6. +0 −2 actionpack/lib/action_controller/metal.rb
  7. +0 −1 actionpack/lib/action_controller/metal/helpers.rb
  8. +0 −1 actionpack/lib/action_controller/metal/mime_responds.rb
  9. +0 −10 actionpack/lib/action_controller/metal/responder.rb
  10. +0 −1 actionpack/lib/action_controller/metal/streaming.rb
  11. +0 −2 actionpack/lib/action_dispatch/http/mime_negotiation.rb
  12. +0 −1 actionpack/lib/action_dispatch/middleware/reloader.rb
  13. +0 −1 actionpack/lib/action_dispatch/routing.rb
  14. +0 −1 actionpack/lib/action_dispatch/routing/mapper.rb
  15. +0 −2 actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
  16. +0 −1 actionpack/lib/action_dispatch/routing/redirection.rb
  17. +0 −1 actionpack/lib/action_dispatch/routing/route_set.rb
  18. +0 −1 actionpack/lib/action_dispatch/routing/url_for.rb
  19. +0 −1 actionpack/lib/action_dispatch/testing/assertions/routing.rb
  20. +0 −1 actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb
  21. +0 −1 actionpack/lib/action_view/helpers/capture_helper.rb
  22. +0 −11 actionpack/lib/action_view/helpers/form_helper.rb
  23. +0 −3 actionpack/lib/action_view/helpers/form_options_helper.rb
  24. +0 −3 actionpack/lib/action_view/helpers/form_tag_helper.rb
  25. +0 −1 actionpack/lib/action_view/helpers/number_helper.rb
  26. +0 −1 actionpack/lib/action_view/helpers/output_safety_helper.rb
  27. +0 −2 actionpack/lib/action_view/helpers/record_tag_helper.rb
  28. +0 −1 actionpack/lib/action_view/helpers/rendering_helper.rb
  29. +0 −12 actionpack/lib/action_view/helpers/sanitize_helper.rb
  30. +0 −1 actionpack/lib/action_view/helpers/tags/select.rb
  31. +0 −1 actionpack/lib/action_view/helpers/url_helper.rb
  32. +0 −1 actionpack/lib/action_view/template/resolver.rb
  33. +0 −1 activemodel/lib/active_model/attribute_methods.rb
  34. +0 −1 activemodel/lib/active_model/callbacks.rb
  35. +0 −1 activemodel/lib/active_model/conversion.rb
  36. +0 −1 activemodel/lib/active_model/errors.rb
  37. +0 −2 activemodel/lib/active_model/lint.rb
  38. +0 −2 activemodel/lib/active_model/mass_assignment_security.rb
  39. +0 −2 activemodel/lib/active_model/observing.rb
  40. +0 −1 activemodel/lib/active_model/serialization.rb
  41. +0 −2 activemodel/lib/active_model/validations.rb
  42. +0 −1 activemodel/lib/active_model/validations/validates.rb
  43. +0 −2 activemodel/lib/active_model/validator.rb
  44. +0 −1 activemodel/test/cases/validations/i18n_validation_test.rb
  45. +0 −2 activerecord/lib/active_record/aggregations.rb
  46. +0 −1 activerecord/lib/active_record/associations/association.rb
  47. +0 −1 activerecord/lib/active_record/callbacks.rb
  48. +0 −1 activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
  49. +0 −1 activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
  50. +0 −1 activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
  51. +0 −1 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
  52. +0 −1 activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
  53. +0 −1 activerecord/lib/active_record/locking/optimistic.rb
  54. +0 −1 activerecord/lib/active_record/model.rb
  55. +0 −1 activerecord/lib/active_record/observer.rb
  56. +0 −1 activerecord/lib/active_record/persistence.rb
  57. +0 −6 activerecord/lib/active_record/reflection.rb
  58. +0 −1 activerecord/lib/active_record/relation/calculations.rb
  59. +0 −1 activerecord/lib/active_record/relation/finder_methods.rb
  60. +0 −3 activerecord/lib/active_record/relation/query_methods.rb
  61. +0 −3 activerecord/lib/active_record/relation/spawn_methods.rb
  62. +0 −1 activerecord/lib/active_record/validations/uniqueness.rb
  63. +0 −1 activerecord/test/cases/attribute_methods_test.rb
  64. +0 −1 activerecord/test/cases/validations/i18n_validation_test.rb
  65. +0 −1 activerecord/test/models/subject.rb
  66. +0 −1 activesupport/lib/active_support/benchmarkable.rb
  67. +0 −1 activesupport/lib/active_support/callbacks.rb
  68. +0 −1 activesupport/lib/active_support/concern.rb
  69. +0 −2 activesupport/lib/active_support/configurable.rb
  70. +0 −1 activesupport/lib/active_support/core_ext/array/conversions.rb
  71. +0 −1 activesupport/lib/active_support/core_ext/array/uniq_by.rb
  72. +0 −2 activesupport/lib/active_support/core_ext/enumerable.rb
  73. +0 −1 activesupport/lib/active_support/core_ext/hash/except.rb
  74. +0 −2 activesupport/lib/active_support/core_ext/hash/indifferent_access.rb
  75. +0 −2 activesupport/lib/active_support/core_ext/integer/inflections.rb
  76. +0 −2 activesupport/lib/active_support/core_ext/kernel/reporting.rb
  77. +0 −1 activesupport/lib/active_support/core_ext/module/anonymous.rb
  78. +0 −1 activesupport/lib/active_support/core_ext/module/delegation.rb
  79. +0 −2 activesupport/lib/active_support/core_ext/module/introspection.rb
  80. +0 −7 activesupport/lib/active_support/core_ext/object/blank.rb
  81. +0 −5 activesupport/lib/active_support/core_ext/object/duplicable.rb
  82. +0 −1 activesupport/lib/active_support/core_ext/object/with_options.rb
  83. +0 −1 activesupport/lib/active_support/core_ext/string/inflections.rb
  84. +0 −1 activesupport/lib/active_support/core_ext/string/output_safety.rb
  85. +0 −1 activesupport/lib/active_support/file_update_checker.rb
  86. +0 −4 activesupport/lib/active_support/hash_with_indifferent_access.rb
  87. +0 −1 activesupport/lib/active_support/inflector/methods.rb
  88. +0 −1 activesupport/lib/active_support/lazy_load_hooks.rb
  89. +0 −1 activesupport/lib/active_support/log_subscriber.rb
  90. +0 −2 activesupport/lib/active_support/log_subscriber/test_helper.rb
  91. +0 −1 activesupport/lib/active_support/message_encryptor.rb
  92. +0 −1 activesupport/lib/active_support/notifications.rb
  93. +0 −1 activesupport/lib/active_support/ordered_options.rb
  94. +0 −1 activesupport/lib/active_support/string_inquirer.rb
  95. +0 −2 activesupport/lib/active_support/time_with_zone.rb
  96. +0 −1 railties/lib/rails/application.rb
  97. +0 −1 railties/lib/rails/configuration.rb
  98. +0 −1 railties/lib/rails/engine/configuration.rb
  99. +0 −1 railties/lib/rails/generators/active_model.rb
  100. +0 −1 railties/lib/rails/generators/base.rb
  101. +0 −1 railties/lib/rails/generators/named_base.rb
  102. +0 −2 railties/lib/rails/generators/resource_helpers.rb
  103. +0 −13 railties/lib/rails/generators/test_case.rb
  104. +0 −1 railties/lib/rails/railtie.rb
  105. +0 −1 railties/test/generators/shared_generator_tests.rb
View
1 Rakefile
@@ -179,7 +179,6 @@ end
# We publish a new version by tagging, and pushing a tag does not trigger
# that webhook. Stable docs would be updated by any subsequent regular
# push, but if you want that to happen right away just run this.
-#
desc 'Publishes docs, run this AFTER a new stable tag has been pushed'
task :publish_docs do
Net::HTTP.new('api.rubyonrails.org', 8080).start do |http|
View
1 actionmailer/lib/action_mailer/delivery_methods.rb
@@ -50,7 +50,6 @@ module ClassMethods
# add_delivery_method :sendmail, Mail::Sendmail,
# :location => '/usr/sbin/sendmail',
# :arguments => '-i -t'
- #
def add_delivery_method(symbol, klass, default_options={})
class_attribute(:"#{symbol}_settings") unless respond_to?(:"#{symbol}_settings")
send(:"#{symbol}_settings=", default_options)
View
1 actionmailer/lib/rails/generators/mailer/templates/mailer.rb
@@ -7,7 +7,6 @@ class <%= class_name %> < ActionMailer::Base
# with the following lookup:
#
# en.<%= file_path.tr("/",".") %>.<%= action %>.subject
- #
def <%= action %>
@greeting = "Hi"
View
1 actionpack/lib/abstract_controller/helpers.rb
@@ -90,7 +90,6 @@ def #{meth}(*args, &blk) # def current_user(*args,
# +symbols+, +strings+, +modules+ and blocks.
#
# helper(:three, BlindHelper) { def mice() 'mice' end }
- #
def helper(*args, &block)
modules_for_helpers(args).each do |mod|
add_template_helper(mod)
View
1 actionpack/lib/action_controller/base.rb
@@ -167,7 +167,6 @@ module ActionController
# redirect_to(:action => "elsewhere") and return if monkeys.nil?
# render :action => "overthere" # won't be called if monkeys is nil
# end
- #
class Base < Metal
abstract!
View
2 actionpack/lib/action_controller/metal.rb
@@ -9,7 +9,6 @@ module ActionController
# class PostsController < ApplicationController
# use AuthenticationMiddleware, :except => [:index, :show]
# end
- #
class MiddlewareStack < ActionDispatch::MiddlewareStack #:nodoc:
class Middleware < ActionDispatch::MiddlewareStack::Middleware #:nodoc:
def initialize(klass, *args, &block)
@@ -97,7 +96,6 @@ def build(action, app=nil, &block)
#
# You can refer to the modules included in <tt>ActionController::Base</tt> to see
# other features you can bring into your metal controller.
- #
class Metal < AbstractController::Base
abstract!
View
1 actionpack/lib/action_controller/metal/helpers.rb
@@ -47,7 +47,6 @@ module ActionController
#
# 23 Aug 11:30 | Carolina Railhawks Soccer Match
# N/A | Carolina Railhaws Training Workshop
- #
module Helpers
extend ActiveSupport::Concern
View
1 actionpack/lib/action_controller/metal/mime_responds.rb
@@ -52,7 +52,6 @@ def respond_to(*mimes)
end
# Clear all mime types in <tt>respond_to</tt>.
- #
def clear_respond_to
self.mimes_for_respond_to = Hash.new.freeze
end
View
10 actionpack/lib/action_controller/metal/responder.rb
@@ -142,21 +142,18 @@ def initialize(controller, resources, options={})
# Initializes a new responder an invoke the proper format. If the format is
# not defined, call to_format.
- #
def self.call(*args)
new(*args).respond
end
# Main entry point for responder responsible to dispatch to the proper format.
- #
def respond
method = "to_#{format}"
respond_to?(method) ? send(method) : to_format
end
# HTML format does not render the resource, it always attempt to render a
# template.
- #
def to_html
default_render
rescue ActionView::MissingTemplate => e
@@ -171,7 +168,6 @@ def to_js
# All other formats follow the procedure below. First we try to render a
# template, if the template is not available, we verify if the resource
# responds to :to_format and display it.
- #
def to_format
if get? || !has_errors? || response_overridden?
default_render
@@ -209,14 +205,12 @@ def api_behavior(error)
end
# Checks whether the resource responds to the current format or not.
- #
def resourceful?
resource.respond_to?("to_#{format}")
end
# Returns the resource location by retrieving it from the options or
# returning the resources array.
- #
def resource_location
options[:location] || resources
end
@@ -225,7 +219,6 @@ def resource_location
# If a response block was given, use it, otherwise call render on
# controller.
- #
def default_render
if @default_response
@default_response.call(options)
@@ -250,7 +243,6 @@ def default_render
# Results in:
#
# render :xml => @user, :status => :created
- #
def display(resource, given_options={})
controller.render given_options.merge!(options).merge!(format => resource)
end
@@ -260,14 +252,12 @@ def display_errors
end
# Check whether the resource has errors.
- #
def has_errors?
resource.respond_to?(:errors) && !resource.errors.empty?
end
# By default, render the <code>:edit</code> action for HTML requests with errors, unless
# the verb was POST.
- #
def default_action
@action ||= DEFAULT_ACTIONS_FOR_VERBS[request.request_method_symbol]
end
View
1 actionpack/lib/action_controller/metal/streaming.rb
@@ -194,7 +194,6 @@ module ActionController #:nodoc:
# ==== Passenger
#
# To be described.
- #
module Streaming
extend ActiveSupport::Concern
View
2 actionpack/lib/action_dispatch/http/mime_negotiation.rb
@@ -46,7 +46,6 @@ def accepts
# GET /posts/5.xml | request.format => Mime::XML
# GET /posts/5.xhtml | request.format => Mime::HTML
# GET /posts/5 | request.format => Mime::HTML or MIME::JS, or request.accepts.first
- #
def format(view_path = [])
formats.first
end
@@ -82,7 +81,6 @@ def format=(extension)
# Receives an array of mimes and return the first user sent mime that
# matches the order array.
- #
def negotiate_mime(order)
formats.each do |priority|
if priority == Mime::ALL
View
1 actionpack/lib/action_dispatch/middleware/reloader.rb
@@ -22,7 +22,6 @@ module ActionDispatch
# is false. Callbacks may be registered even when it is not included in the
# middleware stack, but are executed only when <tt>ActionDispatch::Reloader.prepare!</tt>
# or <tt>ActionDispatch::Reloader.cleanup!</tt> are called manually.
- #
class Reloader
include ActiveSupport::Callbacks
View
1 actionpack/lib/action_dispatch/routing.rb
@@ -277,7 +277,6 @@ module ActionDispatch
# rake routes
#
# Target specific controllers by prefixing the command with <tt>CONTROLLER=x</tt>.
- #
module Routing
autoload :Mapper, 'action_dispatch/routing/mapper'
autoload :RouteSet, 'action_dispatch/routing/route_set'
View
1 actionpack/lib/action_dispatch/routing/mapper.rb
@@ -897,7 +897,6 @@ def defaults_from_constraints(constraints)
# resources :articles, :id => /[^\/]+/
#
# This allows any character other than a slash as part of your +:id+.
- #
module Resources
# CANONICAL_ACTIONS holds all actions that does not need a prefix or
# a path appended since they fit properly in their scope level.
View
2 actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
@@ -51,7 +51,6 @@ module Routing
#
# polymorphic_url([blog, @post]) # calls blog.post_path(@post)
# form_for([blog, @post]) # => "/blog/posts/1"
- #
module PolymorphicRoutes
# Constructs a call to a named RESTful route for the given record and returns the
# resulting URL string. For example:
@@ -84,7 +83,6 @@ module PolymorphicRoutes
#
# # the class of a record will also map to the collection
# polymorphic_url(Comment) # same as comments_url()
- #
def polymorphic_url(record_or_hash_or_array, options = {})
if record_or_hash_or_array.kind_of?(Array)
record_or_hash_or_array = record_or_hash_or_array.compact
View
1 actionpack/lib/action_dispatch/routing/redirection.rb
@@ -121,7 +121,6 @@ module Redirection
# a string.
#
# match 'accounts/:name' => redirect(SubdomainRedirector.new('api'))
- #
def redirect(*args, &block)
options = args.extract_options!
status = options.delete(:status) || 301
View
1 actionpack/lib/action_dispatch/routing/route_set.rb
@@ -180,7 +180,6 @@ def define_named_route_methods(name, route)
# Also allow options hash, so you can do:
#
# foo_url(bar, baz, bang, :sort_by => 'baz')
- #
def define_url_helper(route, name, options)
selector = url_helper_name(name, options[:only_path])
View
1 actionpack/lib/action_dispatch/routing/url_for.rb
@@ -79,7 +79,6 @@ module Routing
# end
#
# User.find(1).base_uri # => "/users/1"
- #
module UrlFor
extend ActiveSupport::Concern
include PolymorphicRoutes
View
1 actionpack/lib/action_dispatch/testing/assertions/routing.rb
@@ -140,7 +140,6 @@ def assert_routing(path, options, defaults={}, extras={}, message=nil)
# end
# end
# end
- #
def with_routing
old_routes, @routes = @routes, ActionDispatch::Routing::RouteSet.new
if defined?(@controller) && @controller
View
1 actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb
@@ -139,7 +139,6 @@ def stylesheet_url(source)
# you have too many stylesheets for IE to load.
#
# stylesheet_link_tag :all, :concat => true
- #
def stylesheet_link_tag(*sources)
@stylesheet_include ||= StylesheetIncludeTag.new(config, asset_paths)
@stylesheet_include.include_tag(*sources)
View
1 actionpack/lib/action_view/helpers/capture_helper.rb
@@ -33,7 +33,6 @@ module CaptureHelper
# <body>
# <b><%= @greeting %></b>
# </body></html>
- #
def capture(*args)
value = nil
buffer = with_output_buffer { value = yield(*args) }
View
11 actionpack/lib/action_view/helpers/form_helper.rb
@@ -763,7 +763,6 @@ def label(object_name, method, content_or_options = nil, options = nil, &block)
#
# text_field(:snippet, :code, :size => 20, :class => 'code_input')
# # => <input type="text" id="snippet_code" name="snippet[code]" size="20" value="#{@snippet.code}" class="code_input" />
- #
def text_field(object_name, method, options = {})
Tags::TextField.new(object_name, method, self, options).render
end
@@ -785,7 +784,6 @@ def text_field(object_name, method, options = {})
#
# password_field(:account, :pin, :size => 20, :class => 'form_input')
# # => <input type="password" id="account_pin" name="account[pin]" size="20" class="form_input" />
- #
def password_field(object_name, method, options = {})
Tags::PasswordField.new(object_name, method, self, options).render
end
@@ -824,7 +822,6 @@ def hidden_field(object_name, method, options = {})
#
# file_field(:attachment, :file, :class => 'file_input')
# # => <input type="file" id="attachment_file" name="attachment[file]" class="file_input" />
- #
def file_field(object_name, method, options = {})
Tags::FileField.new(object_name, method, self, options).render
end
@@ -913,7 +910,6 @@ def text_area(object_name, method, options = {})
# check_box("eula", "accepted", { :class => 'eula_check' }, "yes", "no")
# # => <input name="eula[accepted]" type="hidden" value="no" />
# # <input type="checkbox" class="eula_check" id="eula_accepted" name="eula[accepted]" value="yes" />
- #
def check_box(object_name, method, options = {}, checked_value = "1", unchecked_value = "0")
Tags::CheckBox.new(object_name, method, self, checked_value, unchecked_value, options).render
end
@@ -966,7 +962,6 @@ def search_field(object_name, method, options = {})
#
# telephone_field("user", "phone")
# # => <input id="user_phone" name="user[phone]" type="tel" />
- #
def telephone_field(object_name, method, options = {})
Tags::TelField.new(object_name, method, self, options).render
end
@@ -985,7 +980,6 @@ def telephone_field(object_name, method, options = {})
# @user.born_on = Date.new(1984, 1, 27)
# date_field("user", "born_on", value: "1984-05-12")
# # => <input id="user_born_on" name="user[born_on]" type="date" value="1984-05-12" />
- #
def date_field(object_name, method, options = {})
Tags::DateField.new(object_name, method, self, options).render
end
@@ -1002,7 +996,6 @@ def date_field(object_name, method, options = {})
# === Example
# time_field("task", "started_at")
# # => <input id="task_started_at" name="task[started_at]" type="time" />
- #
def time_field(object_name, method, options = {})
Tags::TimeField.new(object_name, method, self, options).render
end
@@ -1011,7 +1004,6 @@ def time_field(object_name, method, options = {})
#
# url_field("user", "homepage")
# # => <input id="user_homepage" name="user[homepage]" type="url" />
- #
def url_field(object_name, method, options = {})
Tags::UrlField.new(object_name, method, self, options).render
end
@@ -1020,7 +1012,6 @@ def url_field(object_name, method, options = {})
#
# email_field("user", "address")
# # => <input id="user_address" name="user[address]" type="email" />
- #
def email_field(object_name, method, options = {})
Tags::EmailField.new(object_name, method, self, options).render
end
@@ -1200,7 +1191,6 @@ def file_field(method, options = {})
# submit:
# post:
# create: "Add %{model}"
- #
def submit(value=nil, options={})
value, options = nil, value if value.is_a?(Hash)
value ||= submit_default_value
@@ -1233,7 +1223,6 @@ def submit(value=nil, options={})
# submit:
# post:
# create: "Add %{model}"
- #
def button(value=nil, options={})
value, options = nil, value if value.is_a?(Hash)
value ||= submit_default_value
View
3 actionpack/lib/action_view/helpers/form_options_helper.rb
@@ -98,7 +98,6 @@ module Helpers
# <option value="3">Jokes</option>
# <option value="4">Poems</option>
# </select>
- #
module FormOptionsHelper
# ERB::Util can mask some helpers like textilize. Make sure to include them.
include TextHelper
@@ -154,7 +153,6 @@ module FormOptionsHelper
# key in the query string, that works for ordinary forms.
#
# In case if you don't want the helper to generate this hidden field you can specify <tt>:include_blank => false</tt> option.
- #
def select(object, method, choices, options = {}, html_options = {})
Tags::Select.new(object, method, self, choices, options, html_options).render
end
@@ -241,7 +239,6 @@ def collection_select(object, method, collection, value_method, text_method, opt
# <option value="2">Ireland</option>
# </optgroup>
# </select>
- #
def grouped_collection_select(object, method, collection, group_method, group_label_method, option_key_method, option_value_method, options = {}, html_options = {})
Tags::GroupedCollectionSelect.new(object, method, self, collection, group_method, group_label_method, option_key_method, option_value_method, options, html_options).render
end
View
3 actionpack/lib/action_view/helpers/form_tag_helper.rb
@@ -63,7 +63,6 @@ module FormTagHelper
#
# form_tag('http://far.away.com/form', :authenticity_token => "cf50faa3fe97702ca1ae")
# # form with custom authenticity token
- #
def form_tag(url_for_options = {}, options = {}, &block)
html_options = html_options_for_form(url_for_options, options)
if block_given?
@@ -409,7 +408,6 @@ def radio_button_tag(name, value, checked = false, options = {})
#
# submit_tag "Save", :confirm => "Are you sure?"
# # => <input name='commit' type='submit' value='Save' data-confirm="Are you sure?" />
- #
def submit_tag(value = "Save changes", options = {})
options = options.stringify_keys
@@ -446,7 +444,6 @@ def submit_tag(value = "Save changes", options = {})
# # => <button name="button" type="button">
# # <strong>Ask me!</strong>
# # </button>
- #
def button_tag(content_or_options = nil, options = nil, &block)
options = content_or_options if block_given? && content_or_options.is_a?(Hash)
options ||= {}
View
1 actionpack/lib/action_view/helpers/number_helper.rb
@@ -514,7 +514,6 @@ def number_to_human_size(number, options = {})
# number_to_human(343, :units => :distance, :precision => 1) # => "300 meters"
# number_to_human(1, :units => :distance) # => "1 meter"
# number_to_human(0.34, :units => :distance) # => "34 centimeters"
- #
def number_to_human(number, options = {})
options = options.symbolize_keys
View
1 actionpack/lib/action_view/helpers/output_safety_helper.rb
@@ -26,7 +26,6 @@ def raw(stringish)
#
# safe_join(["<p>foo</p>".html_safe, "<p>bar</p>".html_safe], "<br />".html_safe)
# # => "<p>foo</p><br /><p>bar</p>"
- #
def safe_join(array, sep=$,)
sep = ERB::Util.html_escape(sep)
View
2 actionpack/lib/action_view/helpers/record_tag_helper.rb
@@ -29,7 +29,6 @@ module RecordTagHelper
#
# <div id="person_123" class="person foo"> Joe Bloggs </div>
# <div id="person_124" class="person foo"> Jane Bloggs </div>
- #
def div_for(record, *args, &block)
content_tag_for(:div, record, *args, &block)
end
@@ -79,7 +78,6 @@ def div_for(record, *args, &block)
# produces:
#
# <li id="person_123" class="person bar">...
- #
def content_tag_for(tag_name, single_or_multiple_records, prefix = nil, options = nil, &block)
options, prefix = prefix, nil if prefix.is_a?(Hash)
View
1 actionpack/lib/action_view/helpers/rendering_helper.rb
@@ -75,7 +75,6 @@ def render(options = {}, locals = {}, &block)
# <html>
# Hello David
# </html>
- #
def _layout_for(*args, &block)
name = args.first
View
12 actionpack/lib/action_view/helpers/sanitize_helper.rb
@@ -55,7 +55,6 @@ module SanitizeHelper
# resulting markup is valid (conforming to a document type) or even well-formed.
# The output may still contain e.g. unescaped '<', '>', '&' characters and
# confuse browsers.
- #
def sanitize(html, options = {})
self.class.white_list_sanitizer.sanitize(html, options).try(:html_safe)
end
@@ -144,7 +143,6 @@ def sanitized_protocol_separator=(value)
# class Application < Rails::Application
# config.action_view.full_sanitizer = MySpecialSanitizer.new
# end
- #
def full_sanitizer
@full_sanitizer ||= HTML::FullSanitizer.new
end
@@ -155,7 +153,6 @@ def full_sanitizer
# class Application < Rails::Application
# config.action_view.link_sanitizer = MySpecialSanitizer.new
# end
- #
def link_sanitizer
@link_sanitizer ||= HTML::LinkSanitizer.new
end
@@ -166,7 +163,6 @@ def link_sanitizer
# class Application < Rails::Application
# config.action_view.white_list_sanitizer = MySpecialSanitizer.new
# end
- #
def white_list_sanitizer
@white_list_sanitizer ||= HTML::WhiteListSanitizer.new
end
@@ -176,7 +172,6 @@ def white_list_sanitizer
# class Application < Rails::Application
# config.action_view.sanitized_uri_attributes = 'lowsrc', 'target'
# end
- #
def sanitized_uri_attributes=(attributes)
HTML::WhiteListSanitizer.uri_attributes.merge(attributes)
end
@@ -186,7 +181,6 @@ def sanitized_uri_attributes=(attributes)
# class Application < Rails::Application
# config.action_view.sanitized_bad_tags = 'embed', 'object'
# end
- #
def sanitized_bad_tags=(attributes)
HTML::WhiteListSanitizer.bad_tags.merge(attributes)
end
@@ -196,7 +190,6 @@ def sanitized_bad_tags=(attributes)
# class Application < Rails::Application
# config.action_view.sanitized_allowed_tags = 'table', 'tr', 'td'
# end
- #
def sanitized_allowed_tags=(attributes)
HTML::WhiteListSanitizer.allowed_tags.merge(attributes)
end
@@ -206,7 +199,6 @@ def sanitized_allowed_tags=(attributes)
# class Application < Rails::Application
# config.action_view.sanitized_allowed_attributes = 'onclick', 'longdesc'
# end
- #
def sanitized_allowed_attributes=(attributes)
HTML::WhiteListSanitizer.allowed_attributes.merge(attributes)
end
@@ -216,7 +208,6 @@ def sanitized_allowed_attributes=(attributes)
# class Application < Rails::Application
# config.action_view.sanitized_allowed_css_properties = 'expression'
# end
- #
def sanitized_allowed_css_properties=(attributes)
HTML::WhiteListSanitizer.allowed_css_properties.merge(attributes)
end
@@ -226,7 +217,6 @@ def sanitized_allowed_css_properties=(attributes)
# class Application < Rails::Application
# config.action_view.sanitized_allowed_css_keywords = 'expression'
# end
- #
def sanitized_allowed_css_keywords=(attributes)
HTML::WhiteListSanitizer.allowed_css_keywords.merge(attributes)
end
@@ -236,7 +226,6 @@ def sanitized_allowed_css_keywords=(attributes)
# class Application < Rails::Application
# config.action_view.sanitized_shorthand_css_properties = 'expression'
# end
- #
def sanitized_shorthand_css_properties=(attributes)
HTML::WhiteListSanitizer.shorthand_css_properties.merge(attributes)
end
@@ -246,7 +235,6 @@ def sanitized_shorthand_css_properties=(attributes)
# class Application < Rails::Application
# config.action_view.sanitized_allowed_protocols = 'ssh', 'feed'
# end
- #
def sanitized_allowed_protocols=(attributes)
HTML::WhiteListSanitizer.allowed_protocols.merge(attributes)
end
View
1 actionpack/lib/action_view/helpers/tags/select.rb
@@ -31,7 +31,6 @@ def render
#
# [nil, []]
# { nil => [] }
- #
def grouped_choices?
!@choices.empty? && @choices.first.respond_to?(:last) && Array === @choices.first.last
end
View
1 actionpack/lib/action_view/helpers/url_helper.rb
@@ -586,7 +586,6 @@ def mail_to(email_address, name = nil, html_options = {})
#
# current_page?(:controller => 'product', :action => 'index')
# # => false
- #
def current_page?(options)
unless request
raise "You cannot use helpers that need to determine the current " \
View
1 actionpack/lib/action_view/template/resolver.rb
@@ -215,7 +215,6 @@ def extract_handler_and_format(path, default_formats)
# * <tt>:locale</tt> - possible locale versions
# * <tt>:formats</tt> - possible request formats (for example html, json, xml...)
# * <tt>:handlers</tt> - possible handlers (for example erb, haml, builder...)
- #
class FileSystemResolver < PathResolver
def initialize(path, pattern=nil)
raise ArgumentError, "path already is a Resolver class" if path.is_a?(Resolver)
View
1 activemodel/lib/active_model/attribute_methods.rb
@@ -53,7 +53,6 @@ class MissingAttributeError < NoMethodError
# hash value.
#
# Hash keys must be strings.
- #
module AttributeMethods
extend ActiveSupport::Concern
View
1 activemodel/lib/active_model/callbacks.rb
@@ -83,7 +83,6 @@ def self.extended(base)
# # obj is the MyModel instance that the callback is being called on
# end
# end
- #
def define_model_callbacks(*callbacks)
options = callbacks.extract_options!
options = {
View
1 activemodel/lib/active_model/conversion.rb
@@ -22,7 +22,6 @@ module ActiveModel
# cm.to_key # => nil
# cm.to_param # => nil
# cm.to_partial_path # => "contact_messages/contact_message"
- #
module Conversion
extend ActiveSupport::Concern
View
1 activemodel/lib/active_model/errors.rb
@@ -317,7 +317,6 @@ def full_message(attribute, message)
# * <tt>activemodel.errors.messages.blank</tt>
# * <tt>errors.attributes.title.blank</tt>
# * <tt>errors.messages.blank</tt>
- #
def generate_message(attribute, type = :invalid, options = {})
type = options.delete(:message) if options[:message].is_a?(Symbol)
View
2 activemodel/lib/active_model/lint.rb
@@ -52,7 +52,6 @@ def model.persisted?() false end
#
# Returns a string giving a relative path. This is used for looking up
# partials. For example, a BlogPost model might return "blog_posts/blog_post"
- #
def test_to_partial_path
assert model.respond_to?(:to_partial_path), "The model should respond to to_partial_path"
assert_kind_of String, model.to_partial_path
@@ -74,7 +73,6 @@ def test_persisted?
#
# Model.model_name must return a string with some convenience methods:
# :human, :singular, and :plural. Check ActiveModel::Naming for more information.
- #
def test_model_naming
assert model.class.respond_to?(:model_name), "The model should respond to model_name"
model_name = model.class.model_name
View
2 activemodel/lib/active_model/mass_assignment_security.rb
@@ -56,8 +56,6 @@ module MassAssignmentSecurity
#
# You can specify your own sanitizer object eg. MySanitizer.new.
# See <tt>ActiveModel::MassAssignmentSecurity::LoggerSanitizer</tt> for example implementation.
- #
- #
module ClassMethods
# Attributes named in this macro are protected from mass-assignment
# whenever attributes are sanitized before assignment. A role for the
View
2 activemodel/lib/active_model/observing.rb
@@ -124,7 +124,6 @@ def inherited(subclass)
#
# This will call +custom_notification+, passing as arguments
# the current object and :foo.
- #
def notify_observers(method, *extra_args)
self.class.notify_observers(method, self, *extra_args)
end
@@ -192,7 +191,6 @@ def notify_observers(method, *extra_args)
# If you're using an Observer in a Rails application with Active Record, be sure to
# read about the necessary configuration in the documentation for
# ActiveRecord::Observer.
- #
class Observer
include Singleton
extend ActiveSupport::DescendantsTracker
View
1 activemodel/lib/active_model/serialization.rb
@@ -115,7 +115,6 @@ def serializable_hash(options = nil)
# @data[key]
# end
# end
- #
alias :read_attribute_for_serialization :send
# Add associations specified via the <tt>:include</tt> option.
View
2 activemodel/lib/active_model/validations.rb
@@ -38,7 +38,6 @@ module ActiveModel
# Note that <tt>ActiveModel::Validations</tt> automatically adds an +errors+ method
# to your instances initialized with a new <tt>ActiveModel::Errors</tt> object, so
# there is no need for you to do this manually.
- #
module Validations
extend ActiveSupport::Concern
@@ -222,7 +221,6 @@ def invalid?(context = nil)
# @data[key]
# end
# end
- #
alias :read_attribute_for_validation :send
protected
View
1 activemodel/lib/active_model/validations/validates.rb
@@ -77,7 +77,6 @@ module ClassMethods
# Or to all at the same time:
#
# validates :password, :presence => true, :confirmation => true, :if => :password_required?
- #
def validates(*attributes)
defaults = attributes.extract_options!.dup
validations = defaults.slice!(*_validates_default_keys)
View
2 activemodel/lib/active_model/validator.rb
@@ -94,15 +94,13 @@ module ActiveModel #:nodoc:
#
# This setup method is only called when used with validation macros or the
# class level <tt>validates_with</tt> method.
- #
class Validator
attr_reader :options
# Returns the kind of the validator. Examples:
#
# PresenceValidator.kind # => :presence
# UniquenessValidator.kind # => :uniqueness
- #
def self.kind
@kind ||= name.split('::').last.underscore.sub(/_validator$/, '').to_sym unless anonymous?
end
View
1 activemodel/test/cases/validations/i18n_validation_test.rb
@@ -65,7 +65,6 @@ def test_errors_full_messages_uses_format
# A set of common cases for ActiveModel::Validations message generation that
# are used to generate tests to keep things DRY
- #
COMMON_CASES = [
# [ case, validation_options, generate_message_options]
[ "given no options", {}, {}],
View
2 activerecord/lib/active_record/aggregations.rb
@@ -166,7 +166,6 @@ def clear_aggregation_cache #:nodoc:
# finds all customers with +balance_amount+ equal to 20 and +balance_currency+ equal to "USD":
#
# Customer.where(:balance => Money.new(20, "USD")).all
- #
module ClassMethods
# Adds reader and writer methods for manipulating a value object:
# <tt>composed_of :address</tt> adds <tt>address</tt> and <tt>address=(new_address)</tt> methods.
@@ -207,7 +206,6 @@ module ClassMethods
# :mapping => %w(ip to_i),
# :constructor => Proc.new { |ip| IPAddr.new(ip, Socket::AF_INET) },
# :converter => Proc.new { |ip| ip.is_a?(Integer) ? IPAddr.new(ip, Socket::AF_INET) : IPAddr.new(ip.to_s) }
- #
def composed_of(part_id, options = {})
options.assert_valid_keys(:class_name, :mapping, :allow_nil, :constructor, :converter)
View
1 activerecord/lib/active_record/associations/association.rb
@@ -34,7 +34,6 @@ def initialize(owner, reflection)
# Returns the name of the table of the related class:
#
# post.comments.aliased_table_name # => "comments"
- #
def aliased_table_name
klass.table_name
end
View
1 activerecord/lib/active_record/callbacks.rb
@@ -229,7 +229,6 @@ module ActiveRecord
# Topic._save_callbacks.select { |cb| cb.kind.eql?(:before) }.collect(&:filter).include?(:rest_when_dead)
#
# Returns true or false depending on whether the proc is contained in the before_save callback chain on a Topic model.
- #
module Callbacks
# We can't define callbacks directly on ActiveRecord::Model because
# it is a module. So we queue up the definitions and execute them
View
1 activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
@@ -339,7 +339,6 @@ def native
# t.remove_index
# t.remove_timestamps
# end
- #
class Table
def initialize(table_name, base)
@table_name = table_name
View
1 activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
@@ -380,7 +380,6 @@ def rename_column(table_name, column_name, new_column_name)
# CREATE UNIQUE INDEX index_accounts_on_branch_id_and_party_id ON accounts(branch_id, party_id) WHERE active
#
# Note: only supported by PostgreSQL
- #
def add_index(table_name, column_name, options = {})
index_name, index_type, index_columns, index_options = add_index_options(table_name, column_name, options)
execute "CREATE #{index_type} INDEX #{quote_column_name(index_name)} ON #{quote_table_name(table_name)} (#{index_columns})#{index_options}"
View
1 activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
@@ -59,7 +59,6 @@ module ConnectionAdapters
# * <tt>:sslcert</tt> - Necessary to use MySQL with an SSL connection.
# * <tt>:sslcapath</tt> - Necessary to use MySQL with an SSL connection.
# * <tt>:sslcipher</tt> - Necessary to use MySQL with an SSL connection.
- #
class MysqlAdapter < AbstractMysqlAdapter
class Column < AbstractMysqlAdapter::Column #:nodoc:
View
1 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -684,7 +684,6 @@ class ExplainPrettyPrinter # :nodoc:
# -> Seq Scan on posts (cost=0.00..28.88 rows=8 width=4)
# Filter: (posts.user_id = 1)
# (6 rows)
- #
def pp(result)
header = result.columns.first
lines = result.rows.map(&:first)
View
1 activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
@@ -265,7 +265,6 @@ class ExplainPrettyPrinter
#
# 0|0|0|SEARCH TABLE users USING INTEGER PRIMARY KEY (rowid=?) (~1 rows)
# 0|1|1|SCAN TABLE posts (~100000 rows)
- #
def pp(result) # :nodoc:
result.rows.map do |row|
row.join('|')
View
1 activerecord/lib/active_record/locking/optimistic.rb
@@ -46,7 +46,6 @@ module Locking
# class Person < ActiveRecord::Base
# self.locking_column = :lock_person
# end
- #
module Optimistic
extend ActiveSupport::Concern
View
1 activerecord/lib/active_record/model.rb
@@ -7,7 +7,6 @@ module ActiveRecord
# class Post
# include ActiveRecord::Model
# end
- #
module Model
module ClassMethods #:nodoc:
include ActiveSupport::Callbacks::ClassMethods
View
1 activerecord/lib/active_record/observer.rb
@@ -87,7 +87,6 @@ module ActiveRecord
# If by any chance you are using observed models in the initialization you can still
# load their observers by calling <tt>ModelObserver.instance</tt> before. Observers are
# singletons and that call instantiates and registers them.
- #
class Observer < ActiveModel::Observer
protected
View
1 activerecord/lib/active_record/persistence.rb
@@ -158,7 +158,6 @@ def becomes(klass)
# * Callbacks are invoked.
# * updated_at/updated_on column is updated if that column is available.
# * Updates all the attributes that are dirty in this object.
- #
def update_attribute(name, value)
name = name.to_s
verify_readonly_attribute(name)
View
6 activerecord/lib/active_record/reflection.rb
@@ -42,7 +42,6 @@ def reflect_on_all_aggregations
# Returns the AggregateReflection object for the named +aggregation+ (use the symbol).
#
# Account.reflect_on_aggregation(:balance) # => the balance AggregateReflection
- #
def reflect_on_aggregation(aggregation)
reflection = reflections[aggregation]
reflection if reflection.is_a?(AggregateReflection)
@@ -57,7 +56,6 @@ def reflect_on_aggregation(aggregation)
#
# Account.reflect_on_all_associations # returns an array of all associations
# Account.reflect_on_all_associations(:has_many) # returns an array of all has_many associations
- #
def reflect_on_all_associations(macro = nil)
association_reflections = reflections.values.grep(AssociationReflection)
macro ? association_reflections.select { |reflection| reflection.macro == macro } : association_reflections
@@ -67,7 +65,6 @@ def reflect_on_all_associations(macro = nil)
#
# Account.reflect_on_association(:owner) # returns the owner AssociationReflection
# Invoice.reflect_on_association(:line_items).macro # returns :has_many
- #
def reflect_on_association(association)
reflection = reflections[association]
reflection if reflection.is_a?(AssociationReflection)
@@ -386,7 +383,6 @@ class ThroughReflection < AssociationReflection #:nodoc:
# has_many :taggings
# has_many :tags, :through => :taggings
# end
- #
def source_reflection
@source_reflection ||= source_reflection_names.collect { |name| through_reflection.klass.reflect_on_association(name) }.compact.first
end
@@ -401,7 +397,6 @@ def source_reflection
#
# tags_reflection = Post.reflect_on_association(:tags)
# taggings_reflection = tags_reflection.through_reflection
- #
def through_reflection
@through_reflection ||= active_record.reflect_on_association(options[:through])
end
@@ -488,7 +483,6 @@ def association_primary_key(klass = nil)
# Gets an array of possible <tt>:through</tt> source reflection names:
#
# [:singularized, :pluralized]
- #
def source_reflection_names
@source_reflection_names ||= (options[:source] ? [options[:source]] : [name.to_s.singularize, name]).collect { |n| n.to_sym }
end
View
1 activerecord/lib/active_record/relation/calculations.rb
@@ -138,7 +138,6 @@ def calculate(operation, column_name, options = {})
# Person.pluck('DATEDIFF(updated_at, created_at)')
# # SELECT DATEDIFF(updated_at, created_at) FROM people
# # => ['0', '27761', '173']
- #
def pluck(column_name)
if column_name.is_a?(Symbol) && column_names.include?(column_name.to_s)
column_name = "#{table_name}.#{column_name}"
View
1 activerecord/lib/active_record/relation/finder_methods.rb
@@ -49,7 +49,6 @@ def find(*args)
#
# Post.find_by name: 'Spartacus', rating: 4
# Post.find_by "published_at < ?", 2.weeks.ago
- #
def find_by(*args)
where(*args).take
end
View
3 activerecord/lib/active_record/relation/query_methods.rb
@@ -163,7 +163,6 @@ def order!(*args)
# User.order('email DESC').reorder('id ASC').order('name ASC')
#
# generates a query with 'ORDER BY id ASC, name ASC'.
- #
def reorder(*args)
args.blank? ? self : spawn.reorder!(*args)
end
@@ -277,7 +276,6 @@ def lock!(locks = true)
# Post.none # => returning [] instead breaks the previous code
# end
# end
- #
def none
NullRelation.new(@klass, @table)
end
@@ -312,7 +310,6 @@ def create_with!(value)
#
# Topics.select('a.title').from(Topics.approved, :a)
# # => SELECT a.title FROM (SELECT * FROM topics WHERE approved = 't') a
- #
def from(value, subquery_name = nil)
spawn.from!(value, subquery_name)
end
View
3 activerecord/lib/active_record/relation/spawn_methods.rb
@@ -23,7 +23,6 @@ def spawn #:nodoc:
# Post.where(:published => true).merge(recent_posts)
# # Returns the intersection of all published posts with the 5 most recently created posts.
# # (This is just an example. You'd probably want to do this with a single query!)
- #
def merge(other)
if other.is_a?(Array)
to_a & other
@@ -45,7 +44,6 @@ def merge!(other)
#
# Post.order('id asc').except(:order) # discards the order condition
# Post.where('id > 10').order('id asc').except(:where) # discards the where condition but keeps the order
- #
def except(*skips)
result = Relation.new(klass, table, values.except(*skips))
result.default_scoped = default_scoped
@@ -59,7 +57,6 @@ def except(*skips)
#
# Post.order('id asc').only(:where) # discards the order condition
# Post.order('id asc').only(:where, :order) # uses the specified order
- #
def only(*onlies)
result = Relation.new(klass, table, values.slice(*onlies))
result.default_scoped = default_scoped
View
1 activerecord/lib/active_record/validations/uniqueness.rb
@@ -198,7 +198,6 @@ module ClassMethods
# * ActiveRecord::ConnectionAdapters::Mysql2Adapter
# * ActiveRecord::ConnectionAdapters::SQLite3Adapter
# * ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
- #
def validates_uniqueness_of(*attr_names)
validates_with UniquenessValidator, _merge_attributes(attr_names)
end
View
1 activerecord/test/cases/attribute_methods_test.rb
@@ -719,7 +719,6 @@ def test_bulk_update_respects_access_control
def test_read_attribute_overwrites_private_method_not_considered_implemented
# simulate a model with a db column that shares its name an inherited
# private method (e.g. Object#system)
- #
Object.class_eval do
private
def title; "private!"; end
View
1 activerecord/test/cases/validations/i18n_validation_test.rb
@@ -33,7 +33,6 @@ def replied_topic
# A set of common cases for ActiveModel::Validations message generation that
# are used to generate tests to keep things DRY
- #
COMMON_CASES = [
# [ case, validation_options, generate_message_options]
[ "given no options", {}, {}],
View
1 activerecord/test/models/subject.rb
@@ -1,5 +1,4 @@
# used for OracleSynonymTest, see test/synonym_test_oracle.rb
-#
class Subject < ActiveRecord::Base
# added initialization of author_email_address in the same way as in Topic class
View
1 activesupport/lib/active_support/benchmarkable.rb
@@ -44,7 +44,6 @@ def benchmark(message = "Benchmarking", options = {})
end
# Silence the logger during the execution of the block.
- #
def silence
old_logger_level, logger.level = logger.level, ::Logger::ERROR if logger
yield
View
1 activesupport/lib/active_support/callbacks.rb
@@ -341,7 +341,6 @@ def #{name}() #{chain.compile} end
# 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 : {}
View
1 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", [])
View
2 activesupport/lib/active_support/configurable.rb
@@ -48,7 +48,6 @@ def configure
# user = User.new
# user.allowed_access = true
# user.allowed_access # => true
- #
def config_accessor(*names)
options = names.extract_options!
@@ -79,7 +78,6 @@ def config_accessor(*names)
#
# user.config.allowed_access # => true
# user.config.level # => 1
- #
def config
@_config ||= self.class.config.inheritable_copy
end
View
1 activesupport/lib/active_support/core_ext/array/conversions.rb
@@ -136,7 +136,6 @@ def to_formatted_s(format = :default)
# <user-id>1</user-id>
# </message>
# </messages>
- #
def to_xml(options = {})
require 'active_support/builder' unless defined?(Builder)
View
1 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)
View
2 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 @@ def sum(identity = 0, &block)
# => { "nextangle" => <Person ...>, "chade-" => <Person ...>, ...}
# people.index_by { |person| "#{person.first_name} #{person.last_name}" }
# => { "Chade- Fowlersburg-e" => <Person ...>, "David Heinemeier Hansson" => <Person ...>, ...}
- #
def index_by
if block_given?
Hash[map { |elem| [yield(elem), elem] }]
View
1 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
View
2 activesupport/lib/active_support/core_ext/hash/indifferent_access.rb
@@ -5,7 +5,6 @@ class Hash
# Returns an <tt>ActiveSupport::HashWithIndifferentAccess</tt> 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 @@ def with_indifferent_access
#
# b = {:b => 1}
# {:a => b}.with_indifferent_access["a"] # calls b.nested_under_indifferent_access
- #
alias nested_under_indifferent_access with_indifferent_access
end
View
2 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 @@ def ordinalize
# 1003.ordinal # => "rd"
# -11.ordinal # => "th"
# -1001.ordinal # => "st"
- #
def ordinal
ActiveSupport::Inflector.ordinal(self)
end
View
2 activesupport/lib/active_support/core_ext/kernel/reporting.rb
@@ -65,7 +65,6 @@ def suppress(*exception_classes)
#
# stream = capture(:stdout) { puts 'Cool' }
# stream # => "Cool\n"
- #
def capture(stream)
begin
stream = stream.to_s
@@ -83,7 +82,6 @@ def capture(stream)
# Silences both STDOUT and STDERR, even for subprocesses.
#
# quietly { system 'bundle install' }
- #
def quietly
silence_stream(STDOUT) do
silence_stream(STDERR) do
View
1 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
View
1 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]
View
2 activesupport/lib/active_support/core_ext/module/introspection.rb
@@ -27,7 +27,6 @@ def parent_name
#
# M.parent # => Object
# Module.new.parent # => Object
- #
def parent
parent_name ? ActiveSupport::Inflector.constantize(parent_name) : Object
end
@@ -44,7 +43,6 @@ def parent
# M.parents # => [Object]
# M::N.parents # => [M, Object]
# X.parents # => [M, Object]
- #
def parents
parents = []
if parent_name
View
7 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
View
5 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
View
1 activesupport/lib/active_support/core_ext/object/with_options.rb
@@ -36,7 +36,6 @@ class Object
#
# <tt>with_options</tt> 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
View
1 activesupport/lib/active_support/core_ext/string/inflections.rb
@@ -5,7 +5,6 @@
# 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.
#
View
1 activesupport/lib/active_support/core_ext/string/output_safety.rb
@@ -64,7 +64,6 @@ def html_escape_once(s)
# 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
View
1 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
View
4 activesupport/lib/active_support/hash_with_indifferent_access.rb
@@ -53,7 +53,6 @@ def self.[](*args)
#
# hash = HashWithIndifferentAccess.new
# hash[:key] = "value"
- #
def []=(key, value)
regular_writer(convert_key(key), convert_value(value))
end
@@ -69,7 +68,6 @@ def []=(key, value)
# 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 @@ def update(other_hash)
# hash["key"] = "value"
# hash.key? :key # => true
# hash.key? "key" # => true
- #
def key?(key)
super(convert_key(key))
end
@@ -107,7 +104,6 @@ def fetch(key, *extras)
# 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
View
1