1. 07 5月, 2020 2 次提交
    • J
      Add DATE_FORMATS[:inspect] · 2b38bf68
      Jonathan Hefner 提交于
      Follow-up to #39147 and #39168.
      
      By adding a new purpose-specific format, we avoid potential pitfalls
      from concatenating format strings.  We also save a String allocation per
      Time attribute per inspect.
      
      The new format also includes a time zone offset for more introspective
      inspection.
      2b38bf68
    • A
      Don't attempt to add a string to a lambda · 38121340
      Adam Hess 提交于
      DATE_FORMATS can be either a format string or a lambda we don't want to attempt to concat them with a string if we are in the lambda case
      38121340
  2. 05 5月, 2020 1 次提交
    • A
      Inspect time attributes with subsec · a3f4202c
      akinomaeni 提交于
      before
      ```
      p Knot.create
      => #<Knot id: 1, created_at: "2016-05-05 01:29:47">
      ```
      
      after
      ```
      p Knot.create
      => #<Knot id: 1, created_at: "2016-05-05 01:29:47.116928000">
      ```
      a3f4202c
  3. 21 9月, 2019 1 次提交
    • N
      Update for `Time#inspect` · dbb9833e
      Nobuyoshi Nakada 提交于
      Since ruby/ruby@5208c431be, `Time#inspect` is separated from
      `Time#to_s`, and the former may contain the fraction part now.
      dbb9833e
  4. 06 11月, 2018 1 次提交
    • E
      Fix inspect with non-primary key id attribute · 65cd0fda
      Eugene Kenny 提交于
      The `read_attribute` method always returns the primary key when asked to
      read the `id` attribute, even if the primary key isn't named `id`, and
      even if another attribute named `id` exists.
      
      For the `inspect`, `attribute_for_inspect` and `pretty_print` methods,
      this behaviour is undesirable, as they're used to examine the internal
      state of the record. By using `_read_attribute` instead, we'll get the
      real value of the `id` attribute.
      65cd0fda
  5. 23 9月, 2018 1 次提交
    • Y
      Enable `Performance/UnfreezeString` cop · 1b86d901
      yuuji.yaginuma 提交于
      In Ruby 2.3 or later, `String#+@` is available and `+@` is faster than `dup`.
      
      ```ruby
      # frozen_string_literal: true
      
      require "bundler/inline"
      
      gemfile(true) do
        source "https://rubygems.org"
      
        gem "benchmark-ips"
      end
      
      Benchmark.ips do |x|
        x.report('+@') { +"" }
        x.report('dup') { "".dup }
        x.compare!
      end
      ```
      
      ```
      $ ruby -v benchmark.rb
      ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
      Warming up --------------------------------------
                        +@   282.289k i/100ms
                       dup   187.638k i/100ms
      Calculating -------------------------------------
                        +@      6.775M (± 3.6%) i/s -     33.875M in   5.006253s
                       dup      3.320M (± 2.2%) i/s -     16.700M in   5.032125s
      
      Comparison:
                        +@:  6775299.3 i/s
                       dup:  3320400.7 i/s - 2.04x  slower
      
      ```
      1b86d901
  6. 17 2月, 2018 1 次提交
  7. 20 7月, 2017 1 次提交
  8. 02 7月, 2017 1 次提交
  9. 01 7月, 2017 1 次提交
  10. 20 6月, 2017 1 次提交
  11. 07 8月, 2016 2 次提交
  12. 13 1月, 2015 1 次提交
  13. 29 5月, 2014 1 次提交
  14. 22 5月, 2013 1 次提交