aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVijay Dev <vijaydev.cse@gmail.com>2012-05-23 22:43:08 +0530
committerVijay Dev <vijaydev.cse@gmail.com>2012-05-23 22:43:08 +0530
commit1ad0b378cc081937c117577ab628f2160fcc448d (patch)
treea675d20ea606caa653010c57b90d10f173f7dd93
parent2642c2961cda2074cc1495a4635898ca8ab33adf (diff)
downloadrails-1ad0b378cc081937c117577ab628f2160fcc448d.tar.gz
rails-1ad0b378cc081937c117577ab628f2160fcc448d.tar.bz2
rails-1ad0b378cc081937c117577ab628f2160fcc448d.zip
Revert "Remove blank trailing comments"
This reverts commit fa6d921e11363e9b8c4bc10f7aed0b9faffdc33a. Reason: Not a fan of such massive changes. We usually close such changes if made to Rails master as a pull request. Following the same principle here and reverting. [ci skip]
-rw-r--r--Rakefile1
-rw-r--r--actionmailer/lib/action_mailer/delivery_methods.rb1
-rw-r--r--actionmailer/lib/rails/generators/mailer/templates/mailer.rb1
-rw-r--r--actionpack/lib/abstract_controller/helpers.rb1
-rw-r--r--actionpack/lib/action_controller/base.rb1
-rw-r--r--actionpack/lib/action_controller/metal.rb2
-rw-r--r--actionpack/lib/action_controller/metal/helpers.rb1
-rw-r--r--actionpack/lib/action_controller/metal/mime_responds.rb1
-rw-r--r--actionpack/lib/action_controller/metal/responder.rb10
-rw-r--r--actionpack/lib/action_controller/metal/streaming.rb1
-rw-r--r--actionpack/lib/action_dispatch/http/mime_negotiation.rb2
-rw-r--r--actionpack/lib/action_dispatch/middleware/reloader.rb1
-rw-r--r--actionpack/lib/action_dispatch/routing.rb1
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb1
-rw-r--r--actionpack/lib/action_dispatch/routing/polymorphic_routes.rb2
-rw-r--r--actionpack/lib/action_dispatch/routing/redirection.rb1
-rw-r--r--actionpack/lib/action_dispatch/routing/route_set.rb1
-rw-r--r--actionpack/lib/action_dispatch/routing/url_for.rb1
-rw-r--r--actionpack/lib/action_dispatch/testing/assertions/routing.rb1
-rw-r--r--actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb1
-rw-r--r--actionpack/lib/action_view/helpers/capture_helper.rb1
-rw-r--r--actionpack/lib/action_view/helpers/form_helper.rb11
-rw-r--r--actionpack/lib/action_view/helpers/form_options_helper.rb3
-rw-r--r--actionpack/lib/action_view/helpers/form_tag_helper.rb3
-rw-r--r--actionpack/lib/action_view/helpers/number_helper.rb1
-rw-r--r--actionpack/lib/action_view/helpers/output_safety_helper.rb1
-rw-r--r--actionpack/lib/action_view/helpers/record_tag_helper.rb2
-rw-r--r--actionpack/lib/action_view/helpers/rendering_helper.rb1
-rw-r--r--actionpack/lib/action_view/helpers/sanitize_helper.rb12
-rw-r--r--actionpack/lib/action_view/helpers/tags/select.rb1
-rw-r--r--actionpack/lib/action_view/helpers/url_helper.rb1
-rw-r--r--actionpack/lib/action_view/template/resolver.rb1
-rw-r--r--activemodel/lib/active_model/attribute_methods.rb1
-rw-r--r--activemodel/lib/active_model/callbacks.rb1
-rw-r--r--activemodel/lib/active_model/conversion.rb1
-rw-r--r--activemodel/lib/active_model/errors.rb1
-rw-r--r--activemodel/lib/active_model/lint.rb2
-rw-r--r--activemodel/lib/active_model/mass_assignment_security.rb2
-rw-r--r--activemodel/lib/active_model/observing.rb2
-rw-r--r--activemodel/lib/active_model/serialization.rb1
-rw-r--r--activemodel/lib/active_model/validations.rb2
-rw-r--r--activemodel/lib/active_model/validations/validates.rb1
-rw-r--r--activemodel/lib/active_model/validator.rb2
-rw-r--r--activemodel/test/cases/validations/i18n_validation_test.rb1
-rw-r--r--activerecord/lib/active_record/aggregations.rb2
-rw-r--r--activerecord/lib/active_record/associations/association.rb1
-rw-r--r--activerecord/lib/active_record/callbacks.rb1
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb1
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb1
-rw-r--r--activerecord/lib/active_record/connection_adapters/mysql_adapter.rb1
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb1
-rw-r--r--activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb1
-rw-r--r--activerecord/lib/active_record/locking/optimistic.rb1
-rw-r--r--activerecord/lib/active_record/model.rb1
-rw-r--r--activerecord/lib/active_record/observer.rb1
-rw-r--r--activerecord/lib/active_record/persistence.rb1
-rw-r--r--activerecord/lib/active_record/reflection.rb6
-rw-r--r--activerecord/lib/active_record/relation/calculations.rb1
-rw-r--r--activerecord/lib/active_record/relation/finder_methods.rb1
-rw-r--r--activerecord/lib/active_record/relation/query_methods.rb3
-rw-r--r--activerecord/lib/active_record/relation/spawn_methods.rb3
-rw-r--r--activerecord/lib/active_record/validations/uniqueness.rb1
-rw-r--r--activerecord/test/cases/attribute_methods_test.rb1
-rw-r--r--activerecord/test/cases/validations/i18n_validation_test.rb1
-rw-r--r--activerecord/test/models/subject.rb1
-rw-r--r--activesupport/lib/active_support/benchmarkable.rb1
-rw-r--r--activesupport/lib/active_support/callbacks.rb1
-rw-r--r--activesupport/lib/active_support/concern.rb1
-rw-r--r--activesupport/lib/active_support/configurable.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/array/conversions.rb1
-rw-r--r--activesupport/lib/active_support/core_ext/array/uniq_by.rb1
-rw-r--r--activesupport/lib/active_support/core_ext/enumerable.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/hash/except.rb1
-rw-r--r--activesupport/lib/active_support/core_ext/hash/indifferent_access.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/integer/inflections.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/kernel/reporting.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/module/anonymous.rb1
-rw-r--r--activesupport/lib/active_support/core_ext/module/delegation.rb1
-rw-r--r--activesupport/lib/active_support/core_ext/module/introspection.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/object/blank.rb7
-rw-r--r--activesupport/lib/active_support/core_ext/object/duplicable.rb5
-rw-r--r--activesupport/lib/active_support/core_ext/object/with_options.rb1
-rw-r--r--activesupport/lib/active_support/core_ext/string/inflections.rb1
-rw-r--r--activesupport/lib/active_support/core_ext/string/output_safety.rb1
-rw-r--r--activesupport/lib/active_support/file_update_checker.rb1
-rw-r--r--activesupport/lib/active_support/hash_with_indifferent_access.rb4
-rw-r--r--activesupport/lib/active_support/inflector/methods.rb1
-rw-r--r--activesupport/lib/active_support/lazy_load_hooks.rb1
-rw-r--r--activesupport/lib/active_support/log_subscriber.rb1
-rw-r--r--activesupport/lib/active_support/log_subscriber/test_helper.rb2
-rw-r--r--activesupport/lib/active_support/message_encryptor.rb1
-rw-r--r--activesupport/lib/active_support/notifications.rb1
-rw-r--r--activesupport/lib/active_support/ordered_options.rb1
-rw-r--r--activesupport/lib/active_support/string_inquirer.rb1
-rw-r--r--activesupport/lib/active_support/time_with_zone.rb2
-rw-r--r--railties/lib/rails/application.rb1
-rw-r--r--railties/lib/rails/configuration.rb1
-rw-r--r--railties/lib/rails/engine/configuration.rb1
-rw-r--r--railties/lib/rails/generators/active_model.rb1
-rw-r--r--railties/lib/rails/generators/base.rb1
-rw-r--r--railties/lib/rails/generators/named_base.rb1
-rw-r--r--railties/lib/rails/generators/resource_helpers.rb2
-rw-r--r--railties/lib/rails/generators/test_case.rb13
-rw-r--r--railties/lib/rails/railtie.rb1
-rw-r--r--railties/test/generators/shared_generator_tests.rb1
105 files changed, 192 insertions, 0 deletions
diff --git a/Rakefile b/Rakefile
index be42c81f1f..21eb60bbe1 100644
--- a/Rakefile
+++ b/Rakefile
@@ -179,6 +179,7 @@ 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|
diff --git a/actionmailer/lib/action_mailer/delivery_methods.rb b/actionmailer/lib/action_mailer/delivery_methods.rb
index d2ec48b1ab..3b38dbccc7 100644
--- a/actionmailer/lib/action_mailer/delivery_methods.rb
+++ b/actionmailer/lib/action_mailer/delivery_methods.rb
@@ -50,6 +50,7 @@ module ActionMailer
# 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)
diff --git a/actionmailer/lib/rails/generators/mailer/templates/mailer.rb b/actionmailer/lib/rails/generators/mailer/templates/mailer.rb
index 835fc9b148..edcfb4233d 100644
--- a/actionmailer/lib/rails/generators/mailer/templates/mailer.rb
+++ b/actionmailer/lib/rails/generators/mailer/templates/mailer.rb
@@ -7,6 +7,7 @@ class <%= class_name %> < ActionMailer::Base
# with the following lookup:
#
# en.<%= file_path.tr("/",".") %>.<%= action %>.subject
+ #
def <%= action %>
@greeting = "Hi"
diff --git a/actionpack/lib/abstract_controller/helpers.rb b/actionpack/lib/abstract_controller/helpers.rb
index 529f920e6c..4e0672d590 100644
--- a/actionpack/lib/abstract_controller/helpers.rb
+++ b/actionpack/lib/abstract_controller/helpers.rb
@@ -90,6 +90,7 @@ module AbstractController
# +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)
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb
index 90058245f5..71425cd542 100644
--- a/actionpack/lib/action_controller/base.rb
+++ b/actionpack/lib/action_controller/base.rb
@@ -167,6 +167,7 @@ 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!
diff --git a/actionpack/lib/action_controller/metal.rb b/actionpack/lib/action_controller/metal.rb
index 720c0f2258..92433ab462 100644
--- a/actionpack/lib/action_controller/metal.rb
+++ b/actionpack/lib/action_controller/metal.rb
@@ -9,6 +9,7 @@ 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)
@@ -96,6 +97,7 @@ module ActionController
#
# 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!
diff --git a/actionpack/lib/action_controller/metal/helpers.rb b/actionpack/lib/action_controller/metal/helpers.rb
index 598bc6c5cb..86d061e3b7 100644
--- a/actionpack/lib/action_controller/metal/helpers.rb
+++ b/actionpack/lib/action_controller/metal/helpers.rb
@@ -47,6 +47,7 @@ module ActionController
#
# 23 Aug 11:30 | Carolina Railhawks Soccer Match
# N/A | Carolina Railhaws Training Workshop
+ #
module Helpers
extend ActiveSupport::Concern
diff --git a/actionpack/lib/action_controller/metal/mime_responds.rb b/actionpack/lib/action_controller/metal/mime_responds.rb
index d9fc777250..0b800c3c62 100644
--- a/actionpack/lib/action_controller/metal/mime_responds.rb
+++ b/actionpack/lib/action_controller/metal/mime_responds.rb
@@ -52,6 +52,7 @@ module ActionController #:nodoc:
end
# Clear all mime types in <tt>respond_to</tt>.
+ #
def clear_respond_to
self.mimes_for_respond_to = Hash.new.freeze
end
diff --git a/actionpack/lib/action_controller/metal/responder.rb b/actionpack/lib/action_controller/metal/responder.rb
index 5aa3b2ca15..83407846dc 100644
--- a/actionpack/lib/action_controller/metal/responder.rb
+++ b/actionpack/lib/action_controller/metal/responder.rb
@@ -142,11 +142,13 @@ module ActionController #:nodoc:
# 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
@@ -154,6 +156,7 @@ module ActionController #:nodoc:
# HTML format does not render the resource, it always attempt to render a
# template.
+ #
def to_html
default_render
rescue ActionView::MissingTemplate => e
@@ -168,6 +171,7 @@ module ActionController #:nodoc:
# 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
@@ -205,12 +209,14 @@ module ActionController #:nodoc:
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
@@ -219,6 +225,7 @@ module ActionController #:nodoc:
# If a response block was given, use it, otherwise call render on
# controller.
+ #
def default_render
if @default_response
@default_response.call(options)
@@ -243,6 +250,7 @@ module ActionController #:nodoc:
# Results in:
#
# render :xml => @user, :status => :created
+ #
def display(resource, given_options={})
controller.render given_options.merge!(options).merge!(format => resource)
end
@@ -252,12 +260,14 @@ module ActionController #:nodoc:
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
diff --git a/actionpack/lib/action_controller/metal/streaming.rb b/actionpack/lib/action_controller/metal/streaming.rb
index 0c3caa9514..eeb37db2e7 100644
--- a/actionpack/lib/action_controller/metal/streaming.rb
+++ b/actionpack/lib/action_controller/metal/streaming.rb
@@ -194,6 +194,7 @@ module ActionController #:nodoc:
# ==== Passenger
#
# To be described.
+ #
module Streaming
extend ActiveSupport::Concern
diff --git a/actionpack/lib/action_dispatch/http/mime_negotiation.rb b/actionpack/lib/action_dispatch/http/mime_negotiation.rb
index ca40ab9502..e31f3b823d 100644
--- a/actionpack/lib/action_dispatch/http/mime_negotiation.rb
+++ b/actionpack/lib/action_dispatch/http/mime_negotiation.rb
@@ -46,6 +46,7 @@ module ActionDispatch
# 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
@@ -81,6 +82,7 @@ module ActionDispatch
# 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
diff --git a/actionpack/lib/action_dispatch/middleware/reloader.rb b/actionpack/lib/action_dispatch/middleware/reloader.rb
index 23415dae54..2f6968eb2e 100644
--- a/actionpack/lib/action_dispatch/middleware/reloader.rb
+++ b/actionpack/lib/action_dispatch/middleware/reloader.rb
@@ -22,6 +22,7 @@ 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
diff --git a/actionpack/lib/action_dispatch/routing.rb b/actionpack/lib/action_dispatch/routing.rb
index a2a6fb39dc..38a0270151 100644
--- a/actionpack/lib/action_dispatch/routing.rb
+++ b/actionpack/lib/action_dispatch/routing.rb
@@ -277,6 +277,7 @@ 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'
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index 79eee21619..67a208263b 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -897,6 +897,7 @@ module ActionDispatch
# 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.
diff --git a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
index 817cdb2d4e..8fde667108 100644
--- a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
+++ b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
@@ -51,6 +51,7 @@ module ActionDispatch
#
# 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:
@@ -83,6 +84,7 @@ module ActionDispatch
#
# # 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
diff --git a/actionpack/lib/action_dispatch/routing/redirection.rb b/actionpack/lib/action_dispatch/routing/redirection.rb
index d8beba4397..b3823bb496 100644
--- a/actionpack/lib/action_dispatch/routing/redirection.rb
+++ b/actionpack/lib/action_dispatch/routing/redirection.rb
@@ -121,6 +121,7 @@ module ActionDispatch
# a string.
#
# match 'accounts/:name' => redirect(SubdomainRedirector.new('api'))
+ #
def redirect(*args, &block)
options = args.extract_options!
status = options.delete(:status) || 301
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index c5601a82d6..0ae668d42a 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -180,6 +180,7 @@ module ActionDispatch
# 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])
diff --git a/actionpack/lib/action_dispatch/routing/url_for.rb b/actionpack/lib/action_dispatch/routing/url_for.rb
index 207f56aaea..fd3bed7e8f 100644
--- a/actionpack/lib/action_dispatch/routing/url_for.rb
+++ b/actionpack/lib/action_dispatch/routing/url_for.rb
@@ -79,6 +79,7 @@ module ActionDispatch
# end
#
# User.find(1).base_uri # => "/users/1"
+ #
module UrlFor
extend ActiveSupport::Concern
include PolymorphicRoutes
diff --git a/actionpack/lib/action_dispatch/testing/assertions/routing.rb b/actionpack/lib/action_dispatch/testing/assertions/routing.rb
index 1539b894c9..567ca0c392 100644
--- a/actionpack/lib/action_dispatch/testing/assertions/routing.rb
+++ b/actionpack/lib/action_dispatch/testing/assertions/routing.rb
@@ -140,6 +140,7 @@ module ActionDispatch
# end
# end
# end
+ #
def with_routing
old_routes, @routes = @routes, ActionDispatch::Routing::RouteSet.new
if defined?(@controller) && @controller
diff --git a/actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb b/actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb
index d7df9ea0d5..57b0627225 100644
--- a/actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb
+++ b/actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb
@@ -139,6 +139,7 @@ module ActionView
# 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)
diff --git a/actionpack/lib/action_view/helpers/capture_helper.rb b/actionpack/lib/action_view/helpers/capture_helper.rb
index c1f47a2eac..397738dd98 100644
--- a/actionpack/lib/action_view/helpers/capture_helper.rb
+++ b/actionpack/lib/action_view/helpers/capture_helper.rb
@@ -33,6 +33,7 @@ module ActionView
# <body>
# <b><%= @greeting %></b>
# </body></html>
+ #
def capture(*args)
value = nil
buffer = with_output_buffer { value = yield(*args) }
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb
index 12576ecd01..fc81bcea80 100644
--- a/actionpack/lib/action_view/helpers/form_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_helper.rb
@@ -763,6 +763,7 @@ module ActionView
#
# 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
@@ -784,6 +785,7 @@ module ActionView
#
# 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
@@ -822,6 +824,7 @@ module ActionView
#
# 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
@@ -910,6 +913,7 @@ module ActionView
# 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
@@ -962,6 +966,7 @@ module ActionView
#
# 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
@@ -980,6 +985,7 @@ module ActionView
# @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
@@ -996,6 +1002,7 @@ module ActionView
# === 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
@@ -1004,6 +1011,7 @@ module ActionView
#
# 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
@@ -1012,6 +1020,7 @@ module ActionView
#
# 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
@@ -1191,6 +1200,7 @@ module ActionView
# submit:
# post:
# create: "Add %{model}"
+ #
def submit(value=nil, options={})
value, options = nil, value if value.is_a?(Hash)
value ||= submit_default_value
@@ -1223,6 +1233,7 @@ module ActionView
# submit:
# post:
# create: "Add %{model}"
+ #
def button(value=nil, options={})
value, options = nil, value if value.is_a?(Hash)
value ||= submit_default_value
diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb
index 90fa1f3520..eef426703d 100644
--- a/actionpack/lib/action_view/helpers/form_options_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_options_helper.rb
@@ -98,6 +98,7 @@ module ActionView
# <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
@@ -153,6 +154,7 @@ module ActionView
# 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
@@ -239,6 +241,7 @@ module ActionView
# <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
diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb
index 07453c4b50..e65b4e3e95 100644
--- a/actionpack/lib/action_view/helpers/form_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb
@@ -63,6 +63,7 @@ module ActionView
#
# 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?
@@ -408,6 +409,7 @@ module ActionView
#
# 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
@@ -444,6 +446,7 @@ module ActionView
# # => <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 ||= {}
diff --git a/actionpack/lib/action_view/helpers/number_helper.rb b/actionpack/lib/action_view/helpers/number_helper.rb
index 9e43a1faf1..dfc26acfad 100644
--- a/actionpack/lib/action_view/helpers/number_helper.rb
+++ b/actionpack/lib/action_view/helpers/number_helper.rb
@@ -514,6 +514,7 @@ module ActionView
# 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
diff --git a/actionpack/lib/action_view/helpers/output_safety_helper.rb b/actionpack/lib/action_view/helpers/output_safety_helper.rb
index 891dd859fa..2e7e9dc50c 100644
--- a/actionpack/lib/action_view/helpers/output_safety_helper.rb
+++ b/actionpack/lib/action_view/helpers/output_safety_helper.rb
@@ -26,6 +26,7 @@ module ActionView #:nodoc:
#
# 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)
diff --git a/actionpack/lib/action_view/helpers/record_tag_helper.rb b/actionpack/lib/action_view/helpers/record_tag_helper.rb
index 8734136f39..9b35f076e5 100644
--- a/actionpack/lib/action_view/helpers/record_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/record_tag_helper.rb
@@ -29,6 +29,7 @@ module ActionView
#
# <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
@@ -78,6 +79,7 @@ module ActionView
# 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)
diff --git a/actionpack/lib/action_view/helpers/rendering_helper.rb b/actionpack/lib/action_view/helpers/rendering_helper.rb
index 55fb443929..626e1a1ab7 100644
--- a/actionpack/lib/action_view/helpers/rendering_helper.rb
+++ b/actionpack/lib/action_view/helpers/rendering_helper.rb
@@ -75,6 +75,7 @@ module ActionView
# <html>
# Hello David
# </html>
+ #
def _layout_for(*args, &block)
name = args.first
diff --git a/actionpack/lib/action_view/helpers/sanitize_helper.rb b/actionpack/lib/action_view/helpers/sanitize_helper.rb
index ba74217c12..a727b910e5 100644
--- a/actionpack/lib/action_view/helpers/sanitize_helper.rb
+++ b/actionpack/lib/action_view/helpers/sanitize_helper.rb
@@ -55,6 +55,7 @@ module ActionView
# 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
@@ -143,6 +144,7 @@ module ActionView
# class Application < Rails::Application
# config.action_view.full_sanitizer = MySpecialSanitizer.new
# end
+ #
def full_sanitizer
@full_sanitizer ||= HTML::FullSanitizer.new
end
@@ -153,6 +155,7 @@ module ActionView
# class Application < Rails::Application
# config.action_view.link_sanitizer = MySpecialSanitizer.new
# end
+ #
def link_sanitizer
@link_sanitizer ||= HTML::LinkSanitizer.new
end
@@ -163,6 +166,7 @@ module ActionView
# class Application < Rails::Application
# config.action_view.white_list_sanitizer = MySpecialSanitizer.new
# end
+ #
def white_list_sanitizer
@white_list_sanitizer ||= HTML::WhiteListSanitizer.new
end
@@ -172,6 +176,7 @@ module ActionView
# 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
@@ -181,6 +186,7 @@ module ActionView
# 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
@@ -190,6 +196,7 @@ module ActionView
# 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
@@ -199,6 +206,7 @@ module ActionView
# 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
@@ -208,6 +216,7 @@ module ActionView
# 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
@@ -217,6 +226,7 @@ module ActionView
# 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
@@ -226,6 +236,7 @@ module ActionView
# 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
@@ -235,6 +246,7 @@ module ActionView
# 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
diff --git a/actionpack/lib/action_view/helpers/tags/select.rb b/actionpack/lib/action_view/helpers/tags/select.rb
index 4d94ee2c23..53a108b7e6 100644
--- a/actionpack/lib/action_view/helpers/tags/select.rb
+++ b/actionpack/lib/action_view/helpers/tags/select.rb
@@ -31,6 +31,7 @@ module ActionView
#
# [nil, []]
# { nil => [] }
+ #
def grouped_choices?
!@choices.empty? && @choices.first.respond_to?(:last) && Array === @choices.first.last
end
diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb
index 2e45a2ae0f..7e69547dab 100644
--- a/actionpack/lib/action_view/helpers/url_helper.rb
+++ b/actionpack/lib/action_view/helpers/url_helper.rb
@@ -586,6 +586,7 @@ module ActionView
#
# current_page?(:controller => 'product', :action => 'index')
# # => false
+ #
def current_page?(options)
unless request
raise "You cannot use helpers that need to determine the current " \
diff --git a/actionpack/lib/action_view/template/resolver.rb b/actionpack/lib/action_view/template/resolver.rb
index d267a8466a..fa2038f78d 100644
--- a/actionpack/lib/action_view/template/resolver.rb
+++ b/actionpack/lib/action_view/template/resolver.rb
@@ -215,6 +215,7 @@ module ActionView
# * <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)
diff --git a/activemodel/lib/active_model/attribute_methods.rb b/activemodel/lib/active_model/attribute_methods.rb
index 61985e241b..99918fdb96 100644
--- a/activemodel/lib/active_model/attribute_methods.rb
+++ b/activemodel/lib/active_model/attribute_methods.rb
@@ -53,6 +53,7 @@ module ActiveModel
# hash value.
#
# Hash keys must be strings.
+ #
module AttributeMethods
extend ActiveSupport::Concern
diff --git a/activemodel/lib/active_model/callbacks.rb b/activemodel/lib/active_model/callbacks.rb
index 50709e5ee1..ebb4b51aa3 100644
--- a/activemodel/lib/active_model/callbacks.rb
+++ b/activemodel/lib/active_model/callbacks.rb
@@ -83,6 +83,7 @@ module ActiveModel
# # obj is the MyModel instance that the callback is being called on
# end
# end
+ #
def define_model_callbacks(*callbacks)
options = callbacks.extract_options!
options = {
diff --git a/activemodel/lib/active_model/conversion.rb b/activemodel/lib/active_model/conversion.rb
index cea11c1a18..d7f30f0920 100644
--- a/activemodel/lib/active_model/conversion.rb
+++ b/activemodel/lib/active_model/conversion.rb
@@ -22,6 +22,7 @@ module ActiveModel
# cm.to_key # => nil
# cm.to_param # => nil
# cm.to_partial_path # => "contact_messages/contact_message"
+ #
module Conversion
extend ActiveSupport::Concern
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb
index 7b311a50ff..aba6618b56 100644
--- a/activemodel/lib/active_model/errors.rb
+++ b/activemodel/lib/active_model/errors.rb
@@ -317,6 +317,7 @@ module ActiveModel
# * <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)
diff --git a/activemodel/lib/active_model/lint.rb b/activemodel/lib/active_model/lint.rb
index 2c7f2a9334..88b730626c 100644
--- a/activemodel/lib/active_model/lint.rb
+++ b/activemodel/lib/active_model/lint.rb
@@ -52,6 +52,7 @@ module ActiveModel
#
# 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
@@ -73,6 +74,7 @@ module ActiveModel
#
# 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
diff --git a/activemodel/lib/active_model/mass_assignment_security.rb b/activemodel/lib/active_model/mass_assignment_security.rb
index 50951b28d9..893fbf92c3 100644
--- a/activemodel/lib/active_model/mass_assignment_security.rb
+++ b/activemodel/lib/active_model/mass_assignment_security.rb
@@ -56,6 +56,8 @@ module ActiveModel
#
# 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
diff --git a/activemodel/lib/active_model/observing.rb b/activemodel/lib/active_model/observing.rb
index 117c19c412..f5ea285ccb 100644
--- a/activemodel/lib/active_model/observing.rb
+++ b/activemodel/lib/active_model/observing.rb
@@ -124,6 +124,7 @@ module ActiveModel
#
# 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
@@ -191,6 +192,7 @@ module ActiveModel
# 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
diff --git a/activemodel/lib/active_model/serialization.rb b/activemodel/lib/active_model/serialization.rb
index 5fabfb7219..6d8fd21814 100644
--- a/activemodel/lib/active_model/serialization.rb
+++ b/activemodel/lib/active_model/serialization.rb
@@ -115,6 +115,7 @@ module ActiveModel
# @data[key]
# end
# end
+ #
alias :read_attribute_for_serialization :send
# Add associations specified via the <tt>:include</tt> option.
diff --git a/activemodel/lib/active_model/validations.rb b/activemodel/lib/active_model/validations.rb
index 019d4b22cf..611e9ffd55 100644
--- a/activemodel/lib/active_model/validations.rb
+++ b/activemodel/lib/active_model/validations.rb
@@ -38,6 +38,7 @@ 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
@@ -221,6 +222,7 @@ module ActiveModel
# @data[key]
# end
# end
+ #
alias :read_attribute_for_validation :send
protected
diff --git a/activemodel/lib/active_model/validations/validates.rb b/activemodel/lib/active_model/validations/validates.rb
index b6a1cfcf41..d94c4e3f4f 100644
--- a/activemodel/lib/active_model/validations/validates.rb
+++ b/activemodel/lib/active_model/validations/validates.rb
@@ -77,6 +77,7 @@ module ActiveModel
# 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)
diff --git a/activemodel/lib/active_model/validator.rb b/activemodel/lib/active_model/validator.rb
index de1a271dde..2953126c3c 100644
--- a/activemodel/lib/active_model/validator.rb
+++ b/activemodel/lib/active_model/validator.rb
@@ -94,6 +94,7 @@ 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
@@ -101,6 +102,7 @@ module ActiveModel #:nodoc:
#
# PresenceValidator.kind # => :presence
# UniquenessValidator.kind # => :uniqueness
+ #
def self.kind
@kind ||= name.split('::').last.underscore.sub(/_validator$/, '').to_sym unless anonymous?
end
diff --git a/activemodel/test/cases/validations/i18n_validation_test.rb b/activemodel/test/cases/validations/i18n_validation_test.rb
index 0ea9f5393d..6b6aad3bd1 100644
--- a/activemodel/test/cases/validations/i18n_validation_test.rb
+++ b/activemodel/test/cases/validations/i18n_validation_test.rb
@@ -65,6 +65,7 @@ class I18nValidationTest < ActiveModel::TestCase
# 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", {}, {}],
diff --git a/activerecord/lib/active_record/aggregations.rb b/activerecord/lib/active_record/aggregations.rb
index e0392c5a48..6ad16bee2b 100644
--- a/activerecord/lib/active_record/aggregations.rb
+++ b/activerecord/lib/active_record/aggregations.rb
@@ -166,6 +166,7 @@ module ActiveRecord
# 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.
@@ -206,6 +207,7 @@ module ActiveRecord
# :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)
diff --git a/activerecord/lib/active_record/associations/association.rb b/activerecord/lib/active_record/associations/association.rb
index 57d602fd83..e75003f261 100644
--- a/activerecord/lib/active_record/associations/association.rb
+++ b/activerecord/lib/active_record/associations/association.rb
@@ -34,6 +34,7 @@ module ActiveRecord
# Returns the name of the table of the related class:
#
# post.comments.aliased_table_name # => "comments"
+ #
def aliased_table_name
klass.table_name
end
diff --git a/activerecord/lib/active_record/callbacks.rb b/activerecord/lib/active_record/callbacks.rb
index fe18a5d5aa..a050fabf35 100644
--- a/activerecord/lib/active_record/callbacks.rb
+++ b/activerecord/lib/active_record/callbacks.rb
@@ -229,6 +229,7 @@ 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
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
index 95ab375951..df78ba6c5a 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
@@ -339,6 +339,7 @@ module ActiveRecord
# t.remove_index
# t.remove_timestamps
# end
+ #
class Table
def initialize(table_name, base)
@table_name = table_name
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
index e2eb72fdd6..62b0f51bb2 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
@@ -380,6 +380,7 @@ module ActiveRecord
# 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}"
diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
index 3d6ab72e07..0b6734b010 100644
--- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
@@ -59,6 +59,7 @@ module ActiveRecord
# * <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:
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index ad7c4025cf..14bc95abfe 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -684,6 +684,7 @@ module ActiveRecord
# -> 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)
diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
index 25ec88c9c5..d4ffa82b17 100644
--- a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
@@ -265,6 +265,7 @@ module ActiveRecord
#
# 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('|')
diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb
index 604da5a4fd..a3412582fa 100644
--- a/activerecord/lib/active_record/locking/optimistic.rb
+++ b/activerecord/lib/active_record/locking/optimistic.rb
@@ -46,6 +46,7 @@ module ActiveRecord
# class Person < ActiveRecord::Base
# self.locking_column = :lock_person
# end
+ #
module Optimistic
extend ActiveSupport::Concern
diff --git a/activerecord/lib/active_record/model.rb b/activerecord/lib/active_record/model.rb
index 5906a57828..105d1e0e2b 100644
--- a/activerecord/lib/active_record/model.rb
+++ b/activerecord/lib/active_record/model.rb
@@ -7,6 +7,7 @@ module ActiveRecord
# class Post
# include ActiveRecord::Model
# end
+ #
module Model
module ClassMethods #:nodoc:
include ActiveSupport::Callbacks::ClassMethods
diff --git a/activerecord/lib/active_record/observer.rb b/activerecord/lib/active_record/observer.rb
index 2467edcc53..fdf17c003c 100644
--- a/activerecord/lib/active_record/observer.rb
+++ b/activerecord/lib/active_record/observer.rb
@@ -87,6 +87,7 @@ 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
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb
index daf5936a2d..a1bc39a32d 100644
--- a/activerecord/lib/active_record/persistence.rb
+++ b/activerecord/lib/active_record/persistence.rb
@@ -158,6 +158,7 @@ module ActiveRecord
# * 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)
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb
index 17e388a1d4..c380b5c029 100644
--- a/activerecord/lib/active_record/reflection.rb
+++ b/activerecord/lib/active_record/reflection.rb
@@ -42,6 +42,7 @@ module ActiveRecord
# 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)
@@ -56,6 +57,7 @@ module ActiveRecord
#
# 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
@@ -65,6 +67,7 @@ module ActiveRecord
#
# 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)
@@ -383,6 +386,7 @@ module ActiveRecord
# 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
@@ -397,6 +401,7 @@ module ActiveRecord
#
# 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
@@ -483,6 +488,7 @@ module ActiveRecord
# 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
diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb
index 75d983d3b8..31d99f0192 100644
--- a/activerecord/lib/active_record/relation/calculations.rb
+++ b/activerecord/lib/active_record/relation/calculations.rb
@@ -138,6 +138,7 @@ module ActiveRecord
# 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}"
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb
index 9d62e726d4..4fedd33d64 100644
--- a/activerecord/lib/active_record/relation/finder_methods.rb
+++ b/activerecord/lib/active_record/relation/finder_methods.rb
@@ -49,6 +49,7 @@ module ActiveRecord
#
# Post.find_by name: 'Spartacus', rating: 4
# Post.find_by "published_at < ?", 2.weeks.ago
+ #
def find_by(*args)
where(*args).take
end
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb
index c086386da6..19fe8155d9 100644
--- a/activerecord/lib/active_record/relation/query_methods.rb
+++ b/activerecord/lib/active_record/relation/query_methods.rb
@@ -163,6 +163,7 @@ module ActiveRecord
# 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
@@ -276,6 +277,7 @@ module ActiveRecord
# Post.none # => returning [] instead breaks the previous code
# end
# end
+ #
def none
NullRelation.new(@klass, @table)
end
@@ -310,6 +312,7 @@ module ActiveRecord
#
# 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
diff --git a/activerecord/lib/active_record/relation/spawn_methods.rb b/activerecord/lib/active_record/relation/spawn_methods.rb
index 4fb1cb6726..80d087a9ea 100644
--- a/activerecord/lib/active_record/relation/spawn_methods.rb
+++ b/activerecord/lib/active_record/relation/spawn_methods.rb
@@ -23,6 +23,7 @@ module ActiveRecord
# 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
@@ -44,6 +45,7 @@ module ActiveRecord
#
# 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
@@ -57,6 +59,7 @@ module ActiveRecord
#
# 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
diff --git a/activerecord/lib/active_record/validations/uniqueness.rb b/activerecord/lib/active_record/validations/uniqueness.rb
index c1a72ea8b3..9e4b588ac2 100644
--- a/activerecord/lib/active_record/validations/uniqueness.rb
+++ b/activerecord/lib/active_record/validations/uniqueness.rb
@@ -198,6 +198,7 @@ module ActiveRecord
# * ActiveRecord::ConnectionAdapters::Mysql2Adapter
# * ActiveRecord::ConnectionAdapters::SQLite3Adapter
# * ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
+ #
def validates_uniqueness_of(*attr_names)
validates_with UniquenessValidator, _merge_attributes(attr_names)
end
diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb
index eef1366a6d..1093fedea1 100644
--- a/activerecord/test/cases/attribute_methods_test.rb
+++ b/activerecord/test/cases/attribute_methods_test.rb
@@ -719,6 +719,7 @@ class AttributeMethodsTest < ActiveRecord::TestCase
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
diff --git a/activerecord/test/cases/validations/i18n_validation_test.rb b/activerecord/test/cases/validations/i18n_validation_test.rb
index 89b92e0b13..15b97c02c8 100644
--- a/activerecord/test/cases/validations/i18n_validation_test.rb
+++ b/activerecord/test/cases/validations/i18n_validation_test.rb
@@ -33,6 +33,7 @@ class I18nValidationTest < ActiveRecord::TestCase
# 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", {}, {}],
diff --git a/activerecord/test/models/subject.rb b/activerecord/test/models/subject.rb
index 6bf45ba5b2..8e28f8b86b 100644
--- a/activerecord/test/models/subject.rb
+++ b/activerecord/test/models/subject.rb
@@ -1,4 +1,5 @@
# 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
diff --git a/activesupport/lib/active_support/benchmarkable.rb b/activesupport/lib/active_support/benchmarkable.rb
index a39fa016ec..f149a7f0ed 100644
--- a/activesupport/lib/active_support/benchmarkable.rb
+++ b/activesupport/lib/active_support/benchmarkable.rb
@@ -44,6 +44,7 @@ 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 9636bbccb5..a9253c186d 100644
--- a/activesupport/lib/active_support/callbacks.rb
+++ b/activesupport/lib/active_support/callbacks.rb
@@ -341,6 +341,7 @@ 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 9450d4ea88..c94a8d99f4 100644
--- a/activesupport/lib/active_support/concern.rb
+++ b/activesupport/lib/active_support/concern.rb
@@ -94,6 +94,7 @@ 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 afd56cb7ce..a8aa53a80f 100644
--- a/activesupport/lib/active_support/configurable.rb
+++ b/activesupport/lib/active_support/configurable.rb
@@ -48,6 +48,7 @@ module ActiveSupport
# user = User.new
# user.allowed_access = true
# user.allowed_access # => true
+ #
def config_accessor(*names)
options = names.extract_options!
@@ -78,6 +79,7 @@ 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 193388a158..24aa28b895 100644
--- a/activesupport/lib/active_support/core_ext/array/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/array/conversions.rb
@@ -136,6 +136,7 @@ class Array
# <user-id>1</user-id>
# </message>
# </messages>
+ #
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 c1d5a355a4..3bedfa9a61 100644
--- a/activesupport/lib/active_support/core_ext/array/uniq_by.rb
+++ b/activesupport/lib/active_support/core_ext/array/uniq_by.rb
@@ -4,6 +4,7 @@ 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 b950826396..02d5a7080f 100644
--- a/activesupport/lib/active_support/core_ext/enumerable.rb
+++ b/activesupport/lib/active_support/core_ext/enumerable.rb
@@ -17,6 +17,7 @@ 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)
@@ -31,6 +32,7 @@ module Enumerable
# => { "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] }]
diff --git a/activesupport/lib/active_support/core_ext/hash/except.rb b/activesupport/lib/active_support/core_ext/hash/except.rb
index fafd4919b9..5a61906222 100644
--- a/activesupport/lib/active_support/core_ext/hash/except.rb
+++ b/activesupport/lib/active_support/core_ext/hash/except.rb
@@ -10,6 +10,7 @@ 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 c1f368d0eb..7d54c9fae6 100644
--- a/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb
+++ b/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb
@@ -5,6 +5,7 @@ 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
@@ -18,5 +19,6 @@ 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 56f2ed5985..1e30687166 100644
--- a/activesupport/lib/active_support/core_ext/integer/inflections.rb
+++ b/activesupport/lib/active_support/core_ext/integer/inflections.rb
@@ -10,6 +10,7 @@ class Integer
# 1003.ordinalize # => "1003rd"
# -11.ordinalize # => "-11th"
# -1001.ordinalize # => "-1001st"
+ #
def ordinalize
ActiveSupport::Inflector.ordinalize(self)
end
@@ -23,6 +24,7 @@ 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 728069a9a8..ad3f9ebec9 100644
--- a/activesupport/lib/active_support/core_ext/kernel/reporting.rb
+++ b/activesupport/lib/active_support/core_ext/kernel/reporting.rb
@@ -65,6 +65,7 @@ module Kernel
#
# stream = capture(:stdout) { puts 'Cool' }
# stream # => "Cool\n"
+ #
def capture(stream)
begin
stream = stream.to_s
@@ -82,6 +83,7 @@ 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 b0c7b021db..0a9e791030 100644
--- a/activesupport/lib/active_support/core_ext/module/anonymous.rb
+++ b/activesupport/lib/active_support/core_ext/module/anonymous.rb
@@ -13,6 +13,7 @@ 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 30acc87c4a..fbef27c76a 100644
--- a/activesupport/lib/active_support/core_ext/module/delegation.rb
+++ b/activesupport/lib/active_support/core_ext/module/delegation.rb
@@ -100,6 +100,7 @@ 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 649a969149..3c8e811fa4 100644
--- a/activesupport/lib/active_support/core_ext/module/introspection.rb
+++ b/activesupport/lib/active_support/core_ext/module/introspection.rb
@@ -27,6 +27,7 @@ class Module
#
# M.parent # => Object
# Module.new.parent # => Object
+ #
def parent
parent_name ? ActiveSupport::Inflector.constantize(parent_name) : Object
end
@@ -43,6 +44,7 @@ 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 09d9af1bde..e238fef5a2 100644
--- a/activesupport/lib/active_support/core_ext/object/blank.rb
+++ b/activesupport/lib/active_support/core_ext/object/blank.rb
@@ -43,6 +43,7 @@ class NilClass
# +nil+ is blank:
#
# nil.blank? # => true
+ #
def blank?
true
end
@@ -52,6 +53,7 @@ class FalseClass
# +false+ is blank:
#
# false.blank? # => true
+ #
def blank?
true
end
@@ -61,6 +63,7 @@ class TrueClass
# +true+ is not blank:
#
# true.blank? # => false
+ #
def blank?
false
end
@@ -71,6 +74,7 @@ class Array
#
# [].blank? # => true
# [1,2,3].blank? # => false
+ #
alias_method :blank?, :empty?
end
@@ -79,6 +83,7 @@ class Hash
#
# {}.blank? # => true
# {:key => 'value'}.blank? # => false
+ #
alias_method :blank?, :empty?
end
@@ -89,6 +94,7 @@ class String
# ' '.blank? # => true
# ' '.blank? # => true
# ' something here '.blank? # => false
+ #
def blank?
self !~ /[^[:space:]]/
end
@@ -99,6 +105,7 @@ 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 9cd7485e2e..f1b755c2c4 100644
--- a/activesupport/lib/active_support/core_ext/object/duplicable.rb
+++ b/activesupport/lib/active_support/core_ext/object/duplicable.rb
@@ -31,6 +31,7 @@ class NilClass
#
# nil.duplicable? # => false
# nil.dup # => TypeError: can't dup NilClass
+ #
def duplicable?
false
end
@@ -41,6 +42,7 @@ class FalseClass
#
# false.duplicable? # => false
# false.dup # => TypeError: can't dup FalseClass
+ #
def duplicable?
false
end
@@ -51,6 +53,7 @@ class TrueClass
#
# true.duplicable? # => false
# true.dup # => TypeError: can't dup TrueClass
+ #
def duplicable?
false
end
@@ -61,6 +64,7 @@ class Symbol
#
# :my_symbol.duplicable? # => false
# :my_symbol.dup # => TypeError: can't dup Symbol
+ #
def duplicable?
false
end
@@ -71,6 +75,7 @@ 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 723bf69189..e058367111 100644
--- a/activesupport/lib/active_support/core_ext/object/with_options.rb
+++ b/activesupport/lib/active_support/core_ext/object/with_options.rb
@@ -36,6 +36,7 @@ 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
diff --git a/activesupport/lib/active_support/core_ext/string/inflections.rb b/activesupport/lib/active_support/core_ext/string/inflections.rb
index e726a475e0..070bfd7af6 100644
--- a/activesupport/lib/active_support/core_ext/string/inflections.rb
+++ b/activesupport/lib/active_support/core_ext/string/inflections.rb
@@ -5,6 +5,7 @@ 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 d4e1597840..5226ff0cbe 100644
--- a/activesupport/lib/active_support/core_ext/string/output_safety.rb
+++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb
@@ -64,6 +64,7 @@ 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 20dde73abf..8860636168 100644
--- a/activesupport/lib/active_support/file_update_checker.rb
+++ b/activesupport/lib/active_support/file_update_checker.rb
@@ -28,6 +28,7 @@ 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 3191a3bdc6..91459f3e5b 100644
--- a/activesupport/lib/active_support/hash_with_indifferent_access.rb
+++ b/activesupport/lib/active_support/hash_with_indifferent_access.rb
@@ -53,6 +53,7 @@ module ActiveSupport
#
# hash = HashWithIndifferentAccess.new
# hash[:key] = "value"
+ #
def []=(key, value)
regular_writer(convert_key(key), convert_value(value))
end
@@ -68,6 +69,7 @@ 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)
@@ -85,6 +87,7 @@ module ActiveSupport
# hash["key"] = "value"
# hash.key? :key # => true
# hash.key? "key" # => true
+ #
def key?(key)
super(convert_key(key))
end
@@ -104,6 +107,7 @@ 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 53a1c3f160..48296841aa 100644
--- a/activesupport/lib/active_support/inflector/methods.rb
+++ b/activesupport/lib/active_support/inflector/methods.rb
@@ -228,6 +228,7 @@ 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 34450c65d4..c167efc1a7 100644
--- a/activesupport/lib/active_support/lazy_load_hooks.rb
+++ b/activesupport/lib/active_support/lazy_load_hooks.rb
@@ -17,6 +17,7 @@ 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 20ca6ff5f6..d2a6e1bd82 100644
--- a/activesupport/lib/active_support/log_subscriber.rb
+++ b/activesupport/lib/active_support/log_subscriber.rb
@@ -111,6 +111,7 @@ 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 5c7a238934..b65ea6208c 100644
--- a/activesupport/lib/active_support/log_subscriber/test_helper.rb
+++ b/activesupport/lib/active_support/log_subscriber/test_helper.rb
@@ -31,6 +31,7 @@ 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
@@ -95,6 +96,7 @@ 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 c002b1c02c..ada2e79ccb 100644
--- a/activesupport/lib/active_support/message_encryptor.rb
+++ b/activesupport/lib/active_support/message_encryptor.rb
@@ -36,6 +36,7 @@ module ActiveSupport
# Options:
# * <tt>:cipher</tt> - Cipher to use. Can be any cipher returned by <tt>OpenSSL::Cipher.ciphers</tt>. Default is 'aes-256-cbc'
# * <tt>:serializer</tt> - 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 6d89307638..6735c561d3 100644
--- a/activesupport/lib/active_support/notifications.rb
+++ b/activesupport/lib/active_support/notifications.rb
@@ -133,6 +133,7 @@ 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 6bd6f1f2ff..60e6cd55ad 100644
--- a/activesupport/lib/active_support/ordered_options.rb
+++ b/activesupport/lib/active_support/ordered_options.rb
@@ -13,6 +13,7 @@
# 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 e059594bfa..f3f3909a90 100644
--- a/activesupport/lib/active_support/string_inquirer.rb
+++ b/activesupport/lib/active_support/string_inquirer.rb
@@ -8,6 +8,7 @@ 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 f040ee7101..451520ac5c 100644
--- a/activesupport/lib/active_support/time_with_zone.rb
+++ b/activesupport/lib/active_support/time_with_zone.rb
@@ -31,6 +31,7 @@ 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
@@ -126,6 +127,7 @@ 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
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb
index 6cd2c425c3..c4edbae55b 100644
--- a/railties/lib/rails/application.rb
+++ b/railties/lib/rails/application.rb
@@ -48,6 +48,7 @@ module Rails
# 10) Build the middleware stack and run to_prepare callbacks
# 11) Run config.before_eager_load and eager_load if cache classes is true
# 12) Run config.after_initialize callbacks
+ #
class Application < Engine
autoload :Bootstrap, 'rails/application/bootstrap'
autoload :Configuration, 'rails/application/configuration'
diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb
index 57168eee83..3d66019e5e 100644
--- a/railties/lib/rails/configuration.rb
+++ b/railties/lib/rails/configuration.rb
@@ -32,6 +32,7 @@ module Rails
# And finally they can also be removed from the stack completely:
#
# config.middleware.delete ActionDispatch::BestStandardsSupport
+ #
class MiddlewareStackProxy
def initialize
@operations = []
diff --git a/railties/lib/rails/engine/configuration.rb b/railties/lib/rails/engine/configuration.rb
index f4de5a4375..d3b42021fc 100644
--- a/railties/lib/rails/engine/configuration.rb
+++ b/railties/lib/rails/engine/configuration.rb
@@ -28,6 +28,7 @@ module Rails
# If you want to disable color in console, do:
#
# config.generators.colorize_logging = false
+ #
def generators #:nodoc:
@generators ||= Rails::Configuration::Generators.new
yield(@generators) if block_given?
diff --git a/railties/lib/rails/generators/active_model.rb b/railties/lib/rails/generators/active_model.rb
index 3d3b50540a..454327f765 100644
--- a/railties/lib/rails/generators/active_model.rb
+++ b/railties/lib/rails/generators/active_model.rb
@@ -22,6 +22,7 @@ module Rails
#
# The only exception in ActiveModel for ActiveRecord is the use of self.build
# instead of self.new.
+ #
class ActiveModel
attr_reader :name
diff --git a/railties/lib/rails/generators/base.rb b/railties/lib/rails/generators/base.rb
index f2ded6be84..28d7680669 100644
--- a/railties/lib/rails/generators/base.rb
+++ b/railties/lib/rails/generators/base.rb
@@ -161,6 +161,7 @@ module Rails
# hook_for :resource_controller do |instance, controller|
# instance.invoke controller, [ instance.name.pluralize ]
# end
+ #
def self.hook_for(*names, &block)
options = names.extract_options!
in_base = options.delete(:in) || base_name
diff --git a/railties/lib/rails/generators/named_base.rb b/railties/lib/rails/generators/named_base.rb
index e02f19508f..e85d1b8fa2 100644
--- a/railties/lib/rails/generators/named_base.rb
+++ b/railties/lib/rails/generators/named_base.rb
@@ -168,6 +168,7 @@ module Rails
#
# If the generator is invoked with class name Admin, it will check for
# the presence of "AdminObserver".
+ #
def self.check_class_collision(options={})
define_method :check_class_collision do
name = if self.respond_to?(:controller_class_name) # for ScaffoldBase
diff --git a/railties/lib/rails/generators/resource_helpers.rb b/railties/lib/rails/generators/resource_helpers.rb
index 3c12da359b..48833869e5 100644
--- a/railties/lib/rails/generators/resource_helpers.rb
+++ b/railties/lib/rails/generators/resource_helpers.rb
@@ -4,6 +4,7 @@ module Rails
module Generators
# Deal with controller names on scaffold and add some helpers to deal with
# ActiveModel.
+ #
module ResourceHelpers
mattr_accessor :skip_warn
@@ -12,6 +13,7 @@ module Rails
end
# Set controller variables on initialization.
+ #
def initialize(*args) #:nodoc:
super
diff --git a/railties/lib/rails/generators/test_case.rb b/railties/lib/rails/generators/test_case.rb
index e8f5925ca5..ff9cf0087e 100644
--- a/railties/lib/rails/generators/test_case.rb
+++ b/railties/lib/rails/generators/test_case.rb
@@ -26,6 +26,7 @@ module Rails
# destination File.expand_path("../tmp", File.dirname(__FILE__))
# setup :prepare_destination
# end
+ #
class TestCase < ActiveSupport::TestCase
include FileUtils
@@ -42,6 +43,7 @@ module Rails
# Sets which generator should be tested:
#
# tests AppGenerator
+ #
def self.tests(klass)
self.generator_class = klass
end
@@ -50,6 +52,7 @@ module Rails
# invoking it.
#
# arguments %w(app_name --skip-active-record)
+ #
def self.arguments(array)
self.default_arguments = array
end
@@ -57,6 +60,7 @@ module Rails
# Sets the destination of generator files:
#
# destination File.expand_path("../tmp", File.dirname(__FILE__))
+ #
def self.destination(path)
self.destination_root = path
end
@@ -79,6 +83,7 @@ module Rails
# assert_match(/Product\.all/, index)
# end
# end
+ #
def assert_file(relative, *contents)
absolute = File.expand_path(relative, destination_root)
assert File.exists?(absolute), "Expected file #{relative.inspect} to exist, but does not"
@@ -101,6 +106,7 @@ module Rails
# path relative to the configured destination:
#
# assert_no_file "config/random.rb"
+ #
def assert_no_file(relative)
absolute = File.expand_path(relative, destination_root)
assert !File.exists?(absolute), "Expected file #{relative.inspect} to not exist, but does"
@@ -118,6 +124,7 @@ module Rails
# assert_file "db/migrate/003_create_products.rb"
#
# Consequently, assert_migration accepts the same arguments has assert_file.
+ #
def assert_migration(relative, *contents, &block)
file_name = migration_file_name(relative)
assert file_name, "Expected migration #{relative} to exist, but was not found"
@@ -128,6 +135,7 @@ module Rails
# path relative to the configured destination:
#
# assert_no_migration "db/migrate/create_products.rb"
+ #
def assert_no_migration(relative)
file_name = migration_file_name(relative)
assert_nil file_name, "Expected migration #{relative} to not exist, but found #{file_name}"
@@ -142,6 +150,7 @@ module Rails
# assert_match(/create_table/, up)
# end
# end
+ #
def assert_class_method(method, content, &block)
assert_instance_method "self.#{method}", content, &block
end
@@ -154,6 +163,7 @@ module Rails
# assert_match(/Product\.all/, index)
# end
# end
+ #
def assert_instance_method(method, content)
assert content =~ /def #{method}(\(.+\))?(.*?)\n end/m, "Expected to have method #{method}"
yield $2.strip if block_given?
@@ -164,6 +174,7 @@ module Rails
# properly:
#
# assert_field_type :date, :date_select
+ #
def assert_field_type(attribute_type, field_type)
assert_equal(field_type, create_generated_attribute(attribute_type).field_type)
end
@@ -171,6 +182,7 @@ module Rails
# Asserts the given attribute type gets a proper default value:
#
# assert_field_default_value :string, "MyString"
+ #
def assert_field_default_value(attribute_type, value)
assert_equal(value, create_generated_attribute(attribute_type).default)
end
@@ -204,6 +216,7 @@ module Rails
# attribute type and, optionally, the attribute name:
#
# create_generated_attribute(:string, 'name')
+ #
def create_generated_attribute(attribute_type, name = 'test', index = nil)
Rails::Generators::GeneratedAttribute.parse([name, attribute_type, index].compact.join(':'))
end
diff --git a/railties/lib/rails/railtie.rb b/railties/lib/rails/railtie.rb
index 8fbf58315a..2102f8a03c 100644
--- a/railties/lib/rails/railtie.rb
+++ b/railties/lib/rails/railtie.rb
@@ -110,6 +110,7 @@ module Rails
# can be used in both.
#
# Be sure to look at the documentation of those specific classes for more information.
+ #
class Railtie
autoload :Configurable, "rails/railtie/configurable"
autoload :Configuration, "rails/railtie/configuration"
diff --git a/railties/test/generators/shared_generator_tests.rb b/railties/test/generators/shared_generator_tests.rb
index 6dc72f0fc0..e78e67725d 100644
--- a/railties/test/generators/shared_generator_tests.rb
+++ b/railties/test/generators/shared_generator_tests.rb
@@ -1,5 +1,6 @@
#
# Tests, setup, and teardown common to the application and plugin generator suites.
+#
module SharedGeneratorTests
def setup
Rails.application = TestApp::Application