Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Commits on Apr 12, 2015
  1. @ojab

    Speedup String#squish

    ojab authored
Commits on Mar 26, 2015
  1. @vijaydev

    Merge branch 'master' of github.com:rails/docrails

    vijaydev authored
    Conflicts:
    	guides/source/4_0_release_notes.md
Commits on Mar 12, 2015
  1. @yui-knk
Commits on Mar 7, 2015
  1. @wazery

    Doc fixes [ci skip]

    wazery authored
Commits on Feb 28, 2015
  1. @davydovanton
  2. @senny

    Merge pull request #19121 from davydovanton/update-doc-for-remove

    senny authored
    Update documentation examples for String#remove [skip ci]
  3. @davydovanton
Commits on Feb 25, 2015
  1. @nygrenh
Commits on Feb 12, 2015
  1. @chancancode

    Properly dump primitive-like AS::SafeBuffer strings as YAML

    chancancode authored
    `coder.represent_scalar` means something along the lines of "Here is a quoted
    string, you can just add it to the output", which is not the case here. It only
    works for simple strings that can appear unquoted in YAML, but causes problems
    for e.g. primitive-like strings ("1", "true").
    
    `coder.represent_object` on the other hand, means that "This is the Ruby-object
    representation for this thing suitable for use in YAML dumping", which is what
    we want here.
    
    Before:
    
       YAML.load ActiveSupport::SafeBuffer.new("Hello").to_yaml  # => "Hello"
       YAML.load ActiveSupport::SafeBuffer.new("true").to_yaml   # => true
       YAML.load ActiveSupport::SafeBuffer.new("false").to_yaml  # => false
       YAML.load ActiveSupport::SafeBuffer.new("1").to_yaml      # => 1
       YAML.load ActiveSupport::SafeBuffer.new("1.1").to_yaml    # => 1.1
    
     After:
    
       YAML.load ActiveSupport::SafeBuffer.new("Hello").to_yaml  # => "Hello"
       YAML.load ActiveSupport::SafeBuffer.new("true").to_yaml   # => "true"
       YAML.load ActiveSupport::SafeBuffer.new("false").to_yaml  # => "false"
       YAML.load ActiveSupport::SafeBuffer.new("1").to_yaml      # => "1"
       YAML.load ActiveSupport::SafeBuffer.new("1.1").to_yaml    # => "1.1"
    
    If we ever want Ruby to behave more like PHP or JavaScript though, this is an
    excellent trick to use ;)
Commits on Feb 6, 2015
  1. @rafaelfranca

    Merge pull request #14028 from uberllama/json_escape_comments

    rafaelfranca authored
    Amended json_escape comments
Commits on Feb 3, 2015
  1. @vipulnsward
Commits on Jan 4, 2015
  1. @rafaelfranca
Commits on Dec 29, 2014
  1. @rafaelfranca
  2. @vipulnsward

    When trying to access a character on a string buffer object via `:[]`…

    vipulnsward authored
    …, if the object being accessed currently returns `html_safe?` as true,
    
    we used to set  `@html_safe` variable as true on new object created. When doing something like
    
    x = 'Hello'.html_safe
    x[/a/, 1]
    
    would throw an error on ruby 2.2, since when nothign gets matched nil is returned by the code and it tries to set   `@html_safe` value to true,
    which would error since starting 2.2 nil is frozen.
    
    This change adds a safety net to avoid setting `@html_safe = true` on frozen objects.
    
    Fixes #18235
Commits on Nov 24, 2014
  1. @sgrif

    Document `String#html_safe` [ci skip]

    sgrif authored
    It should be part of the documented public API, since we have an entire
    section of the guides dedicated to it. Documented in a way that
    addresses the concerns which kept it undocumented in the past.
Commits on Nov 6, 2014
  1. @rishijain

    added example of squish!, remove, test case for multiple occurrence of

    rishijain authored
    pattern removal
    
    added example for string#remove and test case for remove of multiple occurence of pattern
    
    removed extra whitespaces
Commits on Nov 3, 2014
  1. @rafaelfranca

    Merge pull request #17383 from rwz/string-remove

    rafaelfranca authored
    Make `String#remove` and `String#remove!` accept multiple arguments
    
    Conflicts:
    	activesupport/CHANGELOG.md
Commits on Oct 25, 2014
  1. @rwz
  2. @amatsuda

    instance_eval is evil

    amatsuda authored
Commits on Sep 17, 2014
  1. @akshay-vishnoi

    [ci skip] ActiveSupport CHANGELOG fixes

    akshay-vishnoi authored
    1. spacing issues
    2. spelling correction
    3. grammar correction
    4. Add missing docs
Commits on Sep 15, 2014
  1. @matthewd

    As of Unicode 6.3, Mongolian Vowel Separator is not whitespace

    matthewd authored
    Ruby 2.2 knows this, and no longer matches it with [[:space:]], so it's
    not a good candidate for testing String#squish.
Commits on Jul 16, 2014
  1. @matthewd

    Merge pull request #16190 from oss92/word_truncation

    matthewd authored
    Word truncation
  2. @oss92
Commits on Jul 2, 2014
  1. @chancancode
  2. @johndouthat @chancancode

    Fix escape_once double-escaping hex-encoded entities

    johndouthat authored chancancode committed
    (This is a manual merge of #9102)
Commits on Jun 2, 2014
  1. @tenderlove

    drastically reduce object allocations

    tenderlove authored
    before this change, we were allocating AS::SafeBuffer objects that were
    being interpolated in to a string, so the safe buffer object was being
    thrown away.  This change only allocates a string (vs a string *and* a
    safebuffer) and interpolates the string.
    
    On my test application, this reduced the AS::SafeBuffer objects from
    1527k per request to about 500 per request.
  2. @tenderlove

    reduce AS::SafeBuffer allocations

    tenderlove authored
    html_escape_interpolated_argument is only used in mutation methods:
    
      https://github.com/rails/rails/blob/c07d09559ec171e1904b55c7ad7e8c7d586ca51b/activesupport/lib/active_support/core_ext/string/output_safety.rb#L174
      https://github.com/rails/rails/blob/c07d09559ec171e1904b55c7ad7e8c7d586ca51b/activesupport/lib/active_support/core_ext/string/output_safety.rb#L179
    
    The return value doesn't need to be converted to an AS::SafeBuffer since
    we know that the current object is an AS::SafeBuffer and will be
    mutated, and the return value from html_escape_interpolated_argument
    will be thrown away
  3. @tenderlove
Commits on Apr 18, 2014
  1. @kuldeepaggarwal

    Fix inconsistent behavior from String#pluralize

    kuldeepaggarwal authored
    Before:
      When calling String#pluralize with count=1 then it returned same
      string, but with count other than 1, returned new string.
    
    After:
      String#pluralize always return a new string.
    
      => Prevent mutation of a string inadvertently.
  2. @ernie

    Fix inconsistent behavior from String#first/#last

    ernie authored
    While calling String#first or String#last with zero or a Fixnum < the
    string's length returns a new string, a Fixnum >= the string's length
    returns the string itself. This inconsistency can lead to inadvertent
    mutation of a string.
Commits on Apr 11, 2014
  1. @akshay-vishnoi
Commits on Apr 2, 2014
  1. @carlosantoniodasilva

    Move require to actual file

    carlosantoniodasilva authored
    Change to require all active_support/deprecation since that's the actual
    entry point for the deprecation methods.
  2. @rwz
Commits on Apr 1, 2014
  1. @rwz

    Make AS::SafeBuffer#prepend act like String#prepend

    rwz authored
    Make `#prepend` method modify instance in-place and return self
    instead of just returning modified value. That is exactly what
    `#prepend!` method was doing previously, so it's deprecated from
    now on.
Commits on Feb 12, 2014
  1. @uberllama

    Amended json_escape comment to clarify that user-generated content mu…

    uberllama authored
    …st still be html_escaped if being inserted ingot he DOM via JQuery's html() method.
Something went wrong with that request. Please try again.