Permalink
Browse files

#method vs +method+ in Action Controller

  • Loading branch information...
1 parent 411c675 commit 5ff769afc96717ae87c9fbe977b81b7da47cf5c5 @fxn fxn committed May 19, 2008
View
6 actionpack/lib/action_controller/assertions/routing_assertions.rb
@@ -59,7 +59,7 @@ def assert_recognizes(expected_options, path, extras={}, message=nil)
end
end
- # Asserts that the provided options can be used to generate the provided path. This is the inverse of #assert_recognizes.
+ # Asserts that the provided options can be used to generate the provided path. This is the inverse of +assert_recognizes+.
# The +extras+ parameter is used to tell the request the names and values of additional request parameters that would be in
# a query string. The +message+ parameter allows you to specify a custom error message for assertion failures.
#
@@ -96,8 +96,8 @@ def assert_generates(expected_path, options, defaults={}, extras = {}, message=n
end
# Asserts that path and options match both ways; in other words, it verifies that <tt>path</tt> generates
- # <tt>options</tt> and then that <tt>options</tt> generates <tt>path</tt>. This essentially combines #assert_recognizes
- # and #assert_generates into one step.
+ # <tt>options</tt> and then that <tt>options</tt> generates <tt>path</tt>. This essentially combines +assert_recognizes+
+ # and +assert_generates+ into one step.
#
# The +extras+ hash allows you to specify options that would normally be provided as a query string to the action. The
# +message+ parameter allows you to specify a custom error message to display upon failure.
View
20 actionpack/lib/action_controller/assertions/selector_assertions.rb
@@ -12,12 +12,12 @@ module Assertions
NO_STRIP = %w{pre script style textarea}
end
- # Adds the #assert_select method for use in Rails functional
+ # Adds the +assert_select+ method for use in Rails functional
# test cases, which can be used to make assertions on the response HTML of a controller
- # action. You can also call #assert_select within another #assert_select to
+ # action. You can also call +assert_select+ within another +assert_select+ to
# make assertions on elements selected by the enclosing assertion.
#
- # Use #css_select to select elements without making an assertions, either
+ # Use +css_select+ to select elements without making an assertions, either
# from the response HTML or elements selected by the enclosing assertion.
#
# In addition to HTML responses, you can make the following assertions:
@@ -114,8 +114,8 @@ def css_select(*args)
# starting from (and including) that element and all its children in
# depth-first order.
#
- # If no element if specified, calling #assert_select will select from the
- # response HTML. Calling #assert_select inside an #assert_select block will
+ # If no element if specified, calling +assert_select+ will select from the
+ # response HTML. Calling #assert_select inside an +assert_select+ block will
# run the assertion for each element selected by the enclosing assertion.
#
# ==== Example
@@ -356,16 +356,16 @@ def count_description(min, max) #:nodoc:
#
# === Using blocks
#
- # Without a block, #assert_select_rjs merely asserts that the response
+ # Without a block, +assert_select_rjs+ merely asserts that the response
# contains one or more RJS statements that replace or update content.
#
- # With a block, #assert_select_rjs also selects all elements used in
+ # With a block, +assert_select_rjs+ also selects all elements used in
# these statements and passes them to the block. Nested assertions are
# supported.
#
- # Calling #assert_select_rjs with no arguments and using nested asserts
+ # Calling +assert_select_rjs+ with no arguments and using nested asserts
# asserts that the HTML content is returned by one or more RJS statements.
- # Using #assert_select directly makes the same assertion on the content,
+ # Using +assert_select+ directly makes the same assertion on the content,
# but without distinguishing whether the content is returned in an HTML
# or JavaScript.
#
@@ -601,7 +601,7 @@ def assert_select_email(&block)
RJS_PATTERN_UNICODE_ESCAPED_CHAR = /\\u([0-9a-zA-Z]{4})/
end
- # #assert_select and #css_select call this to obtain the content in the HTML
+ # +assert_select+ and +css_select+ call this to obtain the content in the HTML
# page, or from all the RJS statements, depending on the type of response.
def response_from_page_or_rjs()
content_type = @response.content_type
View
6 actionpack/lib/action_controller/assertions/tag_assertions.rb
@@ -91,7 +91,7 @@ module TagAssertions
# :descendant => { :tag => "span",
# :child => /hello world/ }
#
- # <b>Please note</b>: #assert_tag and #assert_no_tag only work
+ # <b>Please note</b>: +assert_tag+ and +assert_no_tag+ only work
# with well-formed XHTML. They recognize a few tags as implicitly self-closing
# (like br and hr and such) but will not work correctly with tags
# that allow optional closing tags (p, li, td). <em>You must explicitly
@@ -104,8 +104,8 @@ def assert_tag(*opts)
end
end
- # Identical to #assert_tag, but asserts that a matching tag does _not_
- # exist. (See #assert_tag for a full discussion of the syntax.)
+ # Identical to +assert_tag+, but asserts that a matching tag does _not_
+ # exist. (See +assert_tag+ for a full discussion of the syntax.)
#
# === Examples
# # Assert that there is not a "div" containing a "p"
View
38 actionpack/lib/action_controller/filters.rb
@@ -100,10 +100,10 @@ def self.included(base)
#
# Around filters wrap an action, executing code both before and after.
# They may be declared as method references, blocks, or objects responding
- # to #filter or to both #before and #after.
+ # to +filter+ or to both +before+ and +after+.
#
- # To use a method as an around_filter, pass a symbol naming the Ruby method.
- # Yield (or block.call) within the method to run the action.
+ # To use a method as an +around_filter+, pass a symbol naming the Ruby method.
+ # Yield (or <tt>block.call</tt>) within the method to run the action.
#
# around_filter :catch_exceptions
#
@@ -115,17 +115,17 @@ def self.included(base)
# raise
# end
#
- # To use a block as an around_filter, pass a block taking as args both
+ # To use a block as an +around_filter+, pass a block taking as args both
# the controller and the action block. You can't call yield directly from
- # an around_filter block; explicitly call the action block instead:
+ # an +around_filter+ block; explicitly call the action block instead:
#
# around_filter do |controller, action|
# logger.debug "before #{controller.action_name}"
# action.call
# logger.debug "after #{controller.action_name}"
# end
#
- # To use a filter object with around_filter, pass an object responding
+ # To use a filter object with +around_filter+, pass an object responding
# to <tt>:filter</tt> or both <tt>:before</tt> and <tt>:after</tt>. With a
# filter method, yield to the block as above:
#
@@ -137,7 +137,7 @@ def self.included(base)
# end
# end
#
- # With before and after methods:
+ # With +before+ and +after+ methods:
#
# around_filter Authorizer.new
#
@@ -154,9 +154,9 @@ def self.included(base)
# end
# end
#
- # If the filter has before and after methods, the before method will be
- # called before the action. If before renders or redirects, the filter chain is
- # halted and after will not be run. See Filter Chain Halting below for
+ # If the filter has +before+ and +after+ methods, the +before+ method will be
+ # called before the action. If +before+ renders or redirects, the filter chain is
+ # halted and +after+ will not be run. See Filter Chain Halting below for
# an example.
#
# == Filter chain skipping
@@ -241,10 +241,10 @@ def self.included(base)
# . /
# #after (actual filter code is run, unless the around filter does not yield)
#
- # If #around returns before yielding, #after will still not be run. The #before
- # filter and controller action will not be run. If #before renders or redirects,
- # the second half of #around and will still run but #after and the
- # action will not. If #around fails to yield, #after will not be run.
+ # If +around+ returns before yielding, +after+ will still not be run. The +before+
+ # filter and controller action will not be run. If +before+ renders or redirects,
+ # the second half of +around+ and will still run but +after+ and the
+ # action will not. If +around+ fails to yield, +after+ will not be run.
class FilterChain < ActiveSupport::Callbacks::CallbackChain #:nodoc:
def append_filter_to_chain(filters, filter_type, &block)
@@ -471,35 +471,35 @@ def prepend_after_filter(*filters, &block)
# Shorthand for append_after_filter since it's the most common.
alias :after_filter :append_after_filter
- # If you append_around_filter A.new, B.new, the filter chain looks like
+ # If you <tt>append_around_filter A.new, B.new</tt>, the filter chain looks like
#
# B#before
# A#before
# # run the action
# A#after
# B#after
#
- # With around filters which yield to the action block, #before and #after
+ # With around filters which yield to the action block, +before+ and +after+
# are the code before and after the yield.
def append_around_filter(*filters, &block)
filter_chain.append_filter_to_chain(filters, :around, &block)
end
- # If you prepend_around_filter A.new, B.new, the filter chain looks like:
+ # If you <tt>prepend_around_filter A.new, B.new</tt>, the filter chain looks like:
#
# A#before
# B#before
# # run the action
# B#after
# A#after
#
- # With around filters which yield to the action block, #before and #after
+ # With around filters which yield to the action block, +before+ and +after+
# are the code before and after the yield.
def prepend_around_filter(*filters, &block)
filter_chain.prepend_filter_to_chain(filters, :around, &block)
end
- # Shorthand for append_around_filter since it's the most common.
+ # Shorthand for +append_around_filter+ since it's the most common.
alias :around_filter :append_around_filter
# Removes the specified filters from the +before+ filter chain. Note that this only works for skipping method-reference
View
16 actionpack/lib/action_controller/integration.rb
@@ -136,25 +136,25 @@ def request_via_redirect(http_method, path, parameters = nil, headers = nil)
end
# Performs a GET request, following any subsequent redirect.
- # See #request_via_redirect() for more information.
+ # See +request_via_redirect+ for more information.
def get_via_redirect(path, parameters = nil, headers = nil)
request_via_redirect(:get, path, parameters, headers)
end
# Performs a POST request, following any subsequent redirect.
- # See #request_via_redirect() for more information.
+ # See +request_via_redirect+ for more information.
def post_via_redirect(path, parameters = nil, headers = nil)
request_via_redirect(:post, path, parameters, headers)
end
# Performs a PUT request, following any subsequent redirect.
- # See #request_via_redirect() for more information.
+ # See +request_via_redirect+ for more information.
def put_via_redirect(path, parameters = nil, headers = nil)
request_via_redirect(:put, path, parameters, headers)
end
# Performs a DELETE request, following any subsequent redirect.
- # See #request_via_redirect() for more information.
+ # See +request_via_redirect+ for more information.
def delete_via_redirect(path, parameters = nil, headers = nil)
request_via_redirect(:delete, path, parameters, headers)
end
@@ -166,12 +166,12 @@ def redirect?
# Performs a GET request with the given parameters. The parameters may
# be +nil+, a Hash, or a string that is appropriately encoded
- # (application/x-www-form-urlencoded or multipart/form-data). The headers
- # should be a hash. The keys will automatically be upcased, with the
+ # (<tt>application/x-www-form-urlencoded</tt> or <tt>multipart/form-data</tt>).
+ # The headers should be a hash. The keys will automatically be upcased, with the
# prefix 'HTTP_' added if needed.
#
- # You can also perform POST, PUT, DELETE, and HEAD requests with #post,
- # #put, #delete, and #head.
+ # You can also perform POST, PUT, DELETE, and HEAD requests with +post+,
+ # +put+, +delete+, and +head+.
def get(path, parameters = nil, headers = nil)
process :get, path, parameters, headers
end
View
6 actionpack/lib/action_controller/resources.rb
@@ -191,7 +191,7 @@ def initialize(entity, options)
# end
# end
#
- # Along with the routes themselves, #resources generates named routes for use in
+ # Along with the routes themselves, +resources+ generates named routes for use in
# controllers and views. <tt>map.resources :messages</tt> produces the following named routes and helpers:
#
# Named Route Helpers
@@ -208,7 +208,7 @@ def initialize(entity, options)
# edit_message edit_message_url(id), hash_for_edit_message_url(id),
# edit_message_path(id), hash_for_edit_message_path(id)
#
- # You can use these helpers instead of #url_for or methods that take #url_for parameters. For example:
+ # You can use these helpers instead of +url_for+ or methods that take +url_for+ parameters. For example:
#
# redirect_to :controller => 'messages', :action => 'index'
# # and
@@ -406,7 +406,7 @@ def resources(*entities, &block)
# end
# end
#
- # Along with the routes themselves, #resource generates named routes for
+ # Along with the routes themselves, +resource+ generates named routes for
# use in controllers and views. <tt>map.resource :account</tt> produces
# these named routes and helpers:
#
View
6 actionpack/lib/action_controller/routing/builder.rb
@@ -23,9 +23,9 @@ def multiline_regexp?(expression)
# Accepts a "route path" (a string defining a route), and returns the array
# of segments that corresponds to it. Note that the segment array is only
# partially initialized--the defaults and requirements, for instance, need
- # to be set separately, via the #assign_route_options method, and the
- # #optional? method for each segment will not be reliable until after
- # #assign_route_options is called, as well.
+ # to be set separately, via the +assign_route_options+ method, and the
+ # <tt>optional?</tt> method for each segment will not be reliable until after
+ # +assign_route_options+ is called, as well.
def segments_for_route_path(path)
rest, segments = path, []

0 comments on commit 5ff769a

Please sign in to comment.