1. 25 11月, 2014 1 次提交
    • S
      Document `String#html_safe` [ci skip] · 0349516d
      Sean Griffin 提交于
      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.
      0349516d
  2. 06 11月, 2014 1 次提交
  3. 26 10月, 2014 1 次提交
  4. 25 10月, 2014 1 次提交
  5. 18 9月, 2014 1 次提交
  6. 15 9月, 2014 1 次提交
  7. 17 7月, 2014 1 次提交
  8. 03 7月, 2014 2 次提交
  9. 03 6月, 2014 3 次提交
  10. 19 4月, 2014 2 次提交
    • K
      Fix inconsistent behavior from String#pluralize · 459f7bf3
      Kuldeep Aggarwal 提交于
      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.
      459f7bf3
    • E
      Fix inconsistent behavior from String#first/#last · 9e67954d
      Ernie Miller 提交于
      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.
      9e67954d
  11. 11 4月, 2014 1 次提交
  12. 03 4月, 2014 1 次提交
  13. 02 4月, 2014 1 次提交
  14. 01 4月, 2014 1 次提交
  15. 10 1月, 2014 1 次提交
    • J
      Clarify behavior of json_escape, update examples · 7ce68406
      Jon Jensen 提交于
      The behavior of json_escape was fixed in 2f1c5789, but the doc
      changes and example in that commit incorrectly indicated that the
      return value would be html-safe. Since quotation marks are
      preserved, the raw value is not safe to use in other contexts
      (specifically HTML attributes).
      7ce68406
  16. 08 1月, 2014 1 次提交
    • Y
      Revert "Speedup String#to" · a03fed88
      Yves Senn 提交于
      This reverts commit 2ef1fb2c.
      
      As described in PR #13627 this commit broke functionality when passing
      a negative Fixnum to the `String#to` method:
      
      ```ruby
      assert_equal "hell", s.to(-2)
      ```
      
      Before the revert, this failed with:
      
      ```
        1) Failure:
      StringAccessTest#test_#to_with_negative_Fixnum,_position_is_counted_from_the_end [test/core_ext/string_ext_test.rb:275]:
      Expected: "hell"
        Actual: nil
      ```
      
      This revert is to keep the functionality on `master` working.
      If there is another way to get the performance benefit and keep
      the documented functionality we can add that.
      
      /cc @amatsuda @carlosantoniodasilva
      a03fed88
  17. 14 12月, 2013 1 次提交
    • J
      Fixes interpolation on SafeBuffer · a764938a
      Julien Letessier 提交于
      Interpolation was untested and did not work with hash arguments.
      
      Adds
      - support for interpolation with hash argument
      - tests for the above
      - tests for safe/unsafe interpolation
      a764938a
  18. 05 12月, 2013 5 次提交
  19. 03 12月, 2013 1 次提交
  20. 28 11月, 2013 1 次提交
  21. 12 11月, 2013 1 次提交
  22. 07 11月, 2013 1 次提交
    • C
      Add +capitalize+ option to Inflector.humanize · c61544c7
      claudiob 提交于
      So strings can be humanized without being capitalized:
      
          'employee_salary'.humanize                    # => "Employee salary"
          'employee_salary'.humanize(capitalize: false) # => "employee salary"
      c61544c7
  23. 15 8月, 2013 1 次提交
  24. 14 8月, 2013 1 次提交
  25. 11 7月, 2013 1 次提交
  26. 10 7月, 2013 3 次提交
  27. 04 7月, 2013 1 次提交
  28. 16 5月, 2013 1 次提交
    • R
      Revert "Merge pull request #10600 from aditya-kapoor/code_refactor" · ed738f75
      Rafael Mendonça França 提交于
      This reverts commit 8ce3c1e5, reversing
      changes made to f93da579.
      
      Reason: It slow down the running time.
      
      require "diffbench"
      load 'output_safety.rb'
      
      N = 10000
      b = ActiveSupport::SafeBuffer.new("hello world")
      DiffBench.bm do
        report "capitalize in safe buffer" do
          N.times do
            b.capitalize
          end
        end
      end
      
      > git checkout  069ea45c; diffbench bench.rb;
      diffbench bench.rb;diffbench
      bench.rb;diffbench bench.rb;diffbench
      bench.rb;diffbench bench.rb;diffbench
      bench.rb;
      
      Running benchmark with current working tree
      Checkout HEAD^
      Running benchmark with HEAD^
      Checkout to previous HEAD again
      
                          user     system      total
                          real
      ----------------------------------capitalize
      in safe buffer
      After patch:    0.010000   0.000000   0.010000
      (  0.009733)
      Before patch:   0.010000   0.000000   0.010000
      (  0.007702)
      Improvement: -26%
      
      Running benchmark with current working tree
      Checkout HEAD^
      Running benchmark with HEAD^
      Checkout to previous HEAD again
      
                          user     system      total
                          real
      ----------------------------------capitalize
      in safe buffer
      After patch:    0.010000   0.000000   0.010000
      (  0.009768)
      Before patch:   0.010000   0.000000   0.010000
      (  0.007896)
      Improvement: -24%
      
      Running benchmark with current working tree
      Checkout HEAD^
      Running benchmark with HEAD^
      Checkout to previous HEAD again
      
                          user     system      total
                          real
      ----------------------------------capitalize
      in safe buffer
      After patch:    0.010000   0.000000   0.010000
      (  0.009938)
      Before patch:   0.010000   0.000000   0.010000
      (  0.007768)
      Improvement: -28%
      
      Running benchmark with current working tree
      Checkout HEAD^
      Running benchmark with HEAD^
      Checkout to previous HEAD again
      
                          user     system      total
                          real
      ----------------------------------capitalize
      in safe buffer
      After patch:    0.010000   0.000000   0.010000
      (  0.010001)
      Before patch:   0.010000   0.000000   0.010000
      (  0.007873)
      Improvement: -27%
      
      Running benchmark with current working tree
      Checkout HEAD^
      Running benchmark with HEAD^
      Checkout to previous HEAD again
      
                          user     system      total
                          real
      ----------------------------------capitalize
      in safe buffer
      After patch:    0.010000   0.000000   0.010000
      (  0.009670)
      Before patch:   0.010000   0.000000   0.010000
      (  0.007800)
      Improvement: -24%
      
      Running benchmark with current working tree
      Checkout HEAD^
      Running benchmark with HEAD^
      Checkout to previous HEAD again
      
                          user     system      total
                          real
      ----------------------------------capitalize
      in safe buffer
      After patch:    0.010000   0.000000   0.010000
      (  0.009949)
      Before patch:   0.010000   0.000000   0.010000
      (  0.007752)
      Improvement: -28%
      ed738f75
  29. 14 5月, 2013 2 次提交