aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/string
diff options
context:
space:
mode:
authorFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-09-12 18:40:18 -0500
committerFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-09-12 18:40:18 -0500
commit794a70f94485fb64ed1c49ba8532895306e2001c (patch)
tree44f096bdc08c2df55ce2278a87ea120ed2bee478 /activesupport/lib/active_support/core_ext/string
parentf4e180578c673194f58d4ff5a4a656cc51b2249e (diff)
downloadrails-794a70f94485fb64ed1c49ba8532895306e2001c.tar.gz
rails-794a70f94485fb64ed1c49ba8532895306e2001c.tar.bz2
rails-794a70f94485fb64ed1c49ba8532895306e2001c.zip
update AS/core_ext docs [ci skip]
Diffstat (limited to 'activesupport/lib/active_support/core_ext/string')
-rw-r--r--activesupport/lib/active_support/core_ext/string/filters.rb6
-rw-r--r--activesupport/lib/active_support/core_ext/string/output_safety.rb1
2 files changed, 3 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/core_ext/string/filters.rb b/activesupport/lib/active_support/core_ext/string/filters.rb
index 8644529806..e05447439a 100644
--- a/activesupport/lib/active_support/core_ext/string/filters.rb
+++ b/activesupport/lib/active_support/core_ext/string/filters.rb
@@ -24,16 +24,16 @@ class String
#
# Pass a string or regexp <tt>:separator</tt> to truncate +text+ at a natural break:
#
- # 'Once upon a time in a world far far away'.truncate(27, :separator => ' ')
+ # 'Once upon a time in a world far far away'.truncate(27, separator: ' ')
# # => "Once upon a time in a..."
#
- # 'Once upon a time in a world far far away'.truncate(27, :separator => /\s/)
+ # 'Once upon a time in a world far far away'.truncate(27, separator: /\s/)
# # => "Once upon a time in a..."
#
# The last characters will be replaced with the <tt>:omission</tt> string (defaults to "...")
# for a total length not exceeding <tt>length</tt>:
#
- # 'And they found that many people were sleeping better.'.truncate(25, :omission => '... (continued)')
+ # 'And they found that many people were sleeping better.'.truncate(25, omission: '... (continued)')
# # => "And they f... (continued)"
def truncate(truncate_at, options = {})
return dup unless length > truncate_at
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 dad4b29d46..7d9e5bbe7d 100644
--- a/activesupport/lib/active_support/core_ext/string/output_safety.rb
+++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb
@@ -59,7 +59,6 @@ class ERB
#
# json_escape('{"name":"john","created_at":"2010-04-28T01:39:31Z","id":1}')
# # => {name:john,created_at:2010-04-28T01:39:31Z,id:1}
- #
def json_escape(s)
result = s.to_s.gsub(JSON_ESCAPE_REGEXP) { |special| JSON_ESCAPE[special] }
s.html_safe? ? result.html_safe : result