yuuji.yaginuma
|
1b86d90136
|
Enable Performance/UnfreezeString cop
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
```
|
2018-09-23 08:56:55 +09:00 |
|
Rafael Mendonça França
|
89bcca59e9
|
Remove usage of strip_heredoc in the framework in favor of <<~
Some places we can't remove because Ruby still don't have a method
equivalent to strip_heredoc to be called in an already existent string.
|
2018-02-16 19:28:30 -05:00 |
|
Kir Shatrov
|
831be98f9a
|
Use frozen-string-literal in ActiveRecord
|
2017-07-19 22:27:07 +03:00 |
|
Matthew Draper
|
87b3e226d6
|
Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590 , reversing
changes made to afb66a5a59 .
|
2017-07-02 02:15:17 +09:30 |
|
Matthew Draper
|
3420a14590
|
Merge pull request #29540 from kirs/rubocop-frozen-string
Enforce frozen string in Rubocop
|
2017-07-02 01:11:50 +09:30 |
|
Kir Shatrov
|
cfade1ec7e
|
Enforce frozen string in Rubocop
|
2017-07-01 02:11:03 +03:00 |
|
Pat Allan
|
b86e313df5
|
Make ActiveRecord frozen string literal friendly.
|
2017-06-20 19:43:21 +10:00 |
|
Xavier Noria
|
d22e522179
|
modernizes hash syntax in activerecord
|
2016-08-06 19:37:57 +02:00 |
|
Xavier Noria
|
9617db2078
|
applies new string literal convention in activerecord/test
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
|
2016-08-06 18:26:53 +02:00 |
|
Ethan
|
f5c2bf1097
|
pretty_print will use #inspect if a subclass redefines it
|
2015-01-12 15:17:32 -08:00 |
|
Ethan
|
35983ea0ce
|
implement ActiveRecord::Base#pretty_print + changelog
|
2014-05-29 08:06:03 -04:00 |
|
Takehiro Adachi
|
24f0099ec3
|
Extract AR::Core#inspect and AR::Core.inspect's test code from base_test.rb
The methods got moved to core.rb in commit
b2c9ce341a , but the tests never did.
|
2013-05-22 02:24:37 +09:00 |
|