1. 15 8月, 2013 11 次提交
  2. 14 8月, 2013 11 次提交
  3. 13 8月, 2013 11 次提交
    • R
      Merge pull request #11868 from rajcybage/fix_refute · d126a081
      Rafael Mendonça França 提交于
      using assert_not instead of refute
      d126a081
    • R
      using assert_not instead of refute · 8910f12f
      Rajarshi Das 提交于
      8910f12f
    • J
      Merge pull request #11861 from sadjow/improve-doc-translations-active-record-models · 620f41c9
      José Valim 提交于
      Add plural form example for AR I18n section [ci skip]
      620f41c9
    • S
      23c5d6d9
    • X
      renames the :abort deprecation behaviour to :raise · c7ac0a5b
      Xavier Noria 提交于
      That is a better name, thanks @jeremy.
      c7ac0a5b
    • X
      fixes typo in CHANGELOG · 4c1454db
      Xavier Noria 提交于
      4c1454db
    • X
      defines a new :abort deprecation behaviour that raises · 73aad75f
      Xavier Noria 提交于
      See the CHANGELONG message in the patch for further details.
      73aad75f
    • S
      Merge pull request #11856 from dchelimsky/refactor-duration-inspect · 1577d966
      Steve Klabnik 提交于
      Refactor Duration#inspect
      1577d966
    • D
      Refactor Duration#inspect · af3ea544
      David Chelimsky 提交于
      In preparing https://github.com/rails/rails/pull/11855, it took me a
      minute to understand what was going on due to naming (parts refers first
      to an attr_accessor, then to a local, and is then reassigned), but also
      because the iterator conditionally builds nulls and then removes them.
      
      I refactored to something much more functional-looking that I find
      easier to read, but you may or may not. If you do, great! Enjoy! If
      not, oh well, I tried. Can't win 'em all :)
      
      Rationale:
      
      * no name conflict between local var and attr_accessor
      * no reassignment of local var
      * algorithm spelled out in steps
      * unused items in initial list filtered out early
      * empty-list case handled early instead of reassigning local var
      * no duplication of formatting strings ("0 seconds")
      
      Benchmarks (after PR #11855 merged):
      
      10000.times do
        1.second.inspect
      end
      
      original #inspect
         0.350000   0.000000   0.350000 (  0.354709)
         0.330000   0.000000   0.330000 (  0.331885)
         0.330000   0.000000   0.330000 (  0.334441)
      
      refactored #inspect
         0.340000   0.000000   0.340000 (  0.340080)
         0.340000   0.010000   0.350000 (  0.345069)
         0.330000   0.000000   0.330000 (  0.335873)
      
      10000.times do
        (1.day + 1.month + 2.minutes + 1.day).inspect
      end
      
      original #inspect
         0.400000   0.000000   0.400000 (  0.403027)
         0.400000   0.000000   0.400000 (  0.403781)
         0.390000   0.000000   0.390000 (  0.387596)
      
      refactored #inspect
         0.400000   0.010000   0.410000 (  0.399792)
         0.400000   0.000000   0.400000 (  0.404145)
         0.400000   0.000000   0.400000 (  0.403820)
      af3ea544
    • R
      Merge pull request #11855 from dchelimsky/chop-is-faster · f948814b
      Rafael Mendonça França 提交于
      Use chop instead of singularize in Duration#inspect
      f948814b
    • D
      Use chop instead of singularize in Duration#inspect · 908c0392
      David Chelimsky 提交于
      Even though singularize tells a better story, chop is more than 50%
      faster and is all that is necessary in the case of Duration#inspect, in
      which all of the candidates for chopping appear in the same method and
      are all singularized by removing the final 's'.
      
      Benchmarks:
      
      10000.times do
        1.second.inspect
      end
      
      original #inspect
         0.740000   0.000000   0.740000 (  0.739065)
         0.740000   0.000000   0.740000 (  0.741458)
         0.740000   0.010000   0.750000 (  0.744011)
      
      refactored #inspect
         0.330000   0.000000   0.330000 (  0.333390)
         0.330000   0.000000   0.330000 (  0.331013)
         0.320000   0.000000   0.320000 (  0.330103)
      
      10000.times do
        (1.day + 1.month + 2.minutes + 1.day).inspect
      end
      
      original #inspect
         0.790000   0.000000   0.790000 (  0.794624)
         0.770000   0.000000   0.770000 (  0.774577)
         0.770000   0.010000   0.780000 (  0.771295)
      
      refactored #inspect
         0.390000   0.000000   0.390000 (  0.392921)
         0.400000   0.000000   0.400000 (  0.397412)
         0.370000   0.000000   0.370000 (  0.379660)
      908c0392
  4. 12 8月, 2013 7 次提交