aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/text_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_view/helpers/text_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/text_helper.rb44
1 files changed, 22 insertions, 22 deletions
diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb
index 527bfe0cab..26d2142df9 100644
--- a/actionpack/lib/action_view/helpers/text_helper.rb
+++ b/actionpack/lib/action_view/helpers/text_helper.rb
@@ -43,7 +43,7 @@ module ActionView
# if logged_in
# concat "Logged in!"
# else
- # concat link_to('login', :action => :login)
+ # concat link_to('login', action: :login)
# end
# # will either display "Logged in!" or a login link
# %>
@@ -70,13 +70,13 @@ module ActionView
# truncate("Once upon a time in a world far far away")
# # => "Once upon a time in a world..."
#
- # truncate("Once upon a time in a world far far away", :length => 17)
+ # truncate("Once upon a time in a world far far away", length: 17)
# # => "Once upon a ti..."
#
- # truncate("Once upon a time in a world far far away", :length => 17, :separator => ' ')
+ # truncate("Once upon a time in a world far far away", length: 17, separator: ' ')
# # => "Once upon a..."
#
- # truncate("And they found that many people were sleeping better.", :length => 25, :omission => '... (continued)')
+ # truncate("And they found that many people were sleeping better.", length: 25, omission: '... (continued)')
# # => "And they f... (continued)"
#
# truncate("<p>Once upon a time in a world far far away</p>")
@@ -106,10 +106,10 @@ module ActionView
# highlight('You searched for: ruby, rails, dhh', 'actionpack')
# # => You searched for: ruby, rails, dhh
#
- # highlight('You searched for: rails', ['for', 'rails'], :highlighter => '<em>\1</em>')
+ # highlight('You searched for: rails', ['for', 'rails'], highlighter: '<em>\1</em>')
# # => You searched <em>for</em>: <em>rails</em>
#
- # highlight('You searched for: rails', 'rails', :highlighter => '<a href="search?q=\1">\1</a>')
+ # highlight('You searched for: rails', 'rails', highlighter: '<a href="search?q=\1">\1</a>')
# # => You searched for: <a href="search?q=rails">rails</a>
def highlight(text, phrases, options = {})
highlighter = options.fetch(:highlighter, '<mark>\1</mark>')
@@ -130,22 +130,22 @@ module ActionView
# <tt>:separator</tt> enable to choose the delimation. The resulting string will be stripped in any case. If the +phrase+
# isn't found, nil is returned.
#
- # excerpt('This is an example', 'an', :radius => 5)
+ # excerpt('This is an example', 'an', radius: 5)
# # => ...s is an exam...
#
- # excerpt('This is an example', 'is', :radius => 5)
+ # excerpt('This is an example', 'is', radius: 5)
# # => This is a...
#
# excerpt('This is an example', 'is')
# # => This is an example
#
- # excerpt('This next thing is an example', 'ex', :radius => 2)
+ # excerpt('This next thing is an example', 'ex', radius: 2)
# # => ...next...
#
- # excerpt('This is also an example', 'an', :radius => 8, :omission => '<chop> ')
+ # excerpt('This is also an example', 'an', radius: 8, omission: '<chop> ')
# # => <chop> is also an example
#
- # excerpt('This is a very beautiful morning', 'very', :separator => ' ', :radius => 1)
+ # excerpt('This is a very beautiful morning', 'very', separator: ' ', radius: 1)
# # => ...a very beautiful...
def excerpt(text, phrase, options = {})
return unless text && phrase
@@ -207,10 +207,10 @@ module ActionView
# word_wrap('Once upon a time, in a kingdom called Far Far Away, a king fell ill, and finding a successor to the throne turned out to be more trouble than anyone could have imagined...')
# # => Once upon a time, in a kingdom called Far Far Away, a king fell ill, and finding\na successor to the throne turned out to be more trouble than anyone could have\nimagined...
#
- # word_wrap('Once upon a time', :line_width => 8)
+ # word_wrap('Once upon a time', line_width: 8)
# # => Once\nupon a\ntime
#
- # word_wrap('Once upon a time', :line_width => 1)
+ # word_wrap('Once upon a time', line_width: 1)
# # => Once\nupon\na\ntime
def word_wrap(text, options = {})
line_width = options.fetch(:line_width, 80)
@@ -239,7 +239,7 @@ module ActionView
# simple_format(my_text)
# # => "<p>Here is some basic text...\n<br />...with a line break.</p>"
#
- # simple_format(my_text, {}, :wrapper_tag => "div")
+ # simple_format(my_text, {}, wrapper_tag: "div")
# # => "<div>Here is some basic text...\n<br />...with a line break.</div>"
#
# more_text = "We want to put a paragraph...\n\n...right there."
@@ -247,10 +247,10 @@ module ActionView
# simple_format(more_text)
# # => "<p>We want to put a paragraph...</p>\n\n<p>...right there.</p>"
#
- # simple_format("Look ma! A class!", :class => 'description')
+ # simple_format("Look ma! A class!", class: 'description')
# # => "<p class='description'>Look ma! A class!</p>"
#
- # simple_format("<span>I'm allowed!</span> It's true.", {}, :sanitize => false)
+ # simple_format("<span>I'm allowed!</span> It's true.", {}, sanitize: false)
# # => "<p><span>I'm allowed!</span> It's true.</p>"
def simple_format(text, html_options = {}, options = {})
wrapper_tag = options.fetch(:wrapper_tag, :p)
@@ -288,15 +288,15 @@ module ActionView
#
#
# # Cycle CSS classes for rows, and text colors for values within each row
- # @items = x = [{:first => 'Robert', :middle => 'Daniel', :last => 'James'},
- # {:first => 'Emily', :middle => 'Shannon', :maiden => 'Pike', :last => 'Hicks'},
- # {:first => 'June', :middle => 'Dae', :last => 'Jones'}]
+ # @items = x = [{first: 'Robert', middle: 'Daniel', last: 'James'},
+ # {first: 'Emily', middle: 'Shannon', maiden: 'Pike', last: 'Hicks'},
+ # {first: 'June', middle: 'Dae', last: 'Jones'}]
# <% @items.each do |item| %>
- # <tr class="<%= cycle("odd", "even", :name => "row_class") -%>">
+ # <tr class="<%= cycle("odd", "even", name: "row_class") -%>">
# <td>
# <% item.values.each do |value| %>
# <%# Create a named cycle "colors" %>
- # <span style="color:<%= cycle("red", "green", "blue", :name => "colors") -%>">
+ # <span style="color:<%= cycle("red", "green", "blue", name: "colors") -%>">
# <%= value %>
# </span>
# <% end %>
@@ -342,7 +342,7 @@ module ActionView
# <% @items.each do |item| %>
# <tr class="<%= cycle("even", "odd") -%>">
# <% item.each do |value| %>
- # <span style="color:<%= cycle("#333", "#666", "#999", :name => "colors") -%>">
+ # <span style="color:<%= cycle("#333", "#666", "#999", name: "colors") -%>">
# <%= value %>
# </span>
# <% end %>