Skip to content

Commit 152aa13

Browse files
Gavin Kistnerzverok
authored andcommitted
Use Foo.bar, not Foo::bar, for class methods
There were ~14 instances of `ClassName::class_method_name` in the _src, but ~602 instances of `ClassName.class_method_name`. Though using double colons is syntatically valid, it is less used in the community compared to just using a period. This PR just switches all the instances I found to use periods, for consistency throughout the site.
1 parent 5b7b8d6 commit 152aa13

8 files changed

Lines changed: 18 additions & 18 deletions

File tree

2.4.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ When string is created for usage as a mutable buffer for some large textual data
347347

348348
* **Reason:** Ruby's mutable strings, when used for sequential building of some large text, cause constant reallocations of bigger and bigger memory buffer. By specifying expected capacity beforehand, one can avoid this reallocations.
349349
* **Discussion:** <a class="tracker feature" href="https://bugs.ruby-lang.org/issues/12024">Feature #12024</a>
350-
* **Documentation:** <a class="ruby-doc" href="https://ruby-doc.org/core-2.4.0/String.html#method-c-new"><code>String::new</code></a>
350+
* **Documentation:** <a class="ruby-doc" href="https://ruby-doc.org/core-2.4.0/String.html#method-c-new"><code>String.new</code></a>
351351
* **Code:**
352352
```ruby
353353
s = String.new(capacity: 10_000_000)
@@ -628,7 +628,7 @@ In all contexts where input is split into lines, or received line-by-line, new o
628628
* **Discussion:** <a class="tracker feature" href="https://bugs.ruby-lang.org/issues/12553">Feature #12553</a>
629629
* **Documentation** (feature introduced in 2.4, but comprehensive docs were written in 2.5-2.6):
630630
* <a class="ruby-doc" href="https://ruby-doc.org/core-2.5.0/String.html#method-i-each_line"><code>String#each_line</code></a>, <a class="ruby-doc" href="https://ruby-doc.org/core-2.6/String.html#method-i-lines"><code>String#lines</code></a>,
631-
* <a class="ruby-doc" href="https://ruby-doc.org/core-2.5.0/IO.html#method-i-gets"><code>IO#gets</code></a>, <a class="ruby-doc" href="https://ruby-doc.org/core-2.5.0/IO.html#method-i-readline"><code>IO#readline</code></a>, <a class="ruby-doc" href="https://ruby-doc.org/core-2.5.0/IO.html#method-i-readline"><code>IO#readlines</code></a>, <a class="ruby-doc" href="https://ruby-doc.org/core-2.5.0/IO.html#method-c-foreach"><code>IO::foreach</code></a>, <a class="ruby-doc" href="https://ruby-doc.org/core-2.5.0/IO.html#method-c-readlines"><code>IO::readlines</code></a>,
631+
* <a class="ruby-doc" href="https://ruby-doc.org/core-2.5.0/IO.html#method-i-gets"><code>IO#gets</code></a>, <a class="ruby-doc" href="https://ruby-doc.org/core-2.5.0/IO.html#method-i-readline"><code>IO#readline</code></a>, <a class="ruby-doc" href="https://ruby-doc.org/core-2.5.0/IO.html#method-i-readline"><code>IO#readlines</code></a>, <a class="ruby-doc" href="https://ruby-doc.org/core-2.5.0/IO.html#method-c-foreach"><code>IO.foreach</code></a>, <a class="ruby-doc" href="https://ruby-doc.org/core-2.5.0/IO.html#method-c-readlines"><code>IO.readlines</code></a>,
632632
* _Standard library: methods of the class affected, but no documentation for the change:_ <a class="ruby-doc" href="https://ruby-doc.org/stdlib-2.4.0/libdoc/stringio/rdoc/StringIO.html#method-i-gets"><code>StringIO#gets</code></a>, <a class="ruby-doc" href="https://ruby-doc.org/stdlib-2.4.0/libdoc/stringio/rdoc/StringIO.html#method-i-each_line"><code>StringIO#each_line</code></a>, <a class="ruby-doc" href="https://ruby-doc.org/stdlib-2.4.0/libdoc/stringio/rdoc/StringIO.html#method-i-readlines"><code>StringIO#readlines</code></a>
633633
* **Code:**
634634
```ruby
@@ -727,9 +727,9 @@ Returns an actual name of the method being called, even if aliased.
727727
## Stdlib[](#stdlib)
728728

729729
* `Set`: <a class="ruby-doc" href="https://ruby-doc.org/stdlib-2.4.0/libdoc/set/rdoc/Set.html#method-i-compare_by_identity"><code>#compare_by_identity</code></a> and <a class="ruby-doc" href="https://ruby-doc.org/stdlib-2.4.0/libdoc/set/rdoc/Set.html#method-i-compare_by_identity-3F"><code>#compare_by_identity?</code></a> methods added, behaving the same way as (existing since 1.9) <a class="ruby-doc" href="https://ruby-doc.org/core-2.4.0/Hash.html#method-i-compare_by_identity"><code>Hash#compare_by_identity</code></a>: only elements being the same object (same `#object_id`) are considered same set element. Discussion: <a class="tracker feature" href="https://bugs.ruby-lang.org/issues/12210">Feature #12210</a>
730-
* <a class="ruby-doc" href="https://ruby-doc.org/stdlib-2.4.0/libdoc/csv/rdoc/CSV.html#method-c-new"><code>CSV::new</code></a>: Add a `liberal_parsing` option, allowing to (try to) parse not-completely-valid CSV. Discussion: <a class="tracker feature" href="https://bugs.ruby-lang.org/issues/11839">Feature #11839</a>
730+
* <a class="ruby-doc" href="https://ruby-doc.org/stdlib-2.4.0/libdoc/csv/rdoc/CSV.html#method-c-new"><code>CSV.new</code></a>: Add a `liberal_parsing` option, allowing to (try to) parse not-completely-valid CSV. Discussion: <a class="tracker feature" href="https://bugs.ruby-lang.org/issues/11839">Feature #11839</a>
731731
* `Binding#irb` start a REPL session like `binding.pry`.Follow-up: since [Ruby 2.5](https://rubyreferences.github.io/rubychanges/2.5.html#ruby-development-and-introspection), `require 'irb'` is not necessary for the feature to work, it is done automatically.
732-
* <a class="ruby-doc" href="https://ruby-doc.org/stdlib-2.4.0/libdoc/logger/rdoc/Logger.html#method-c-new"><code>Logger::new</code></a> adds keyword arguments `level:`, `progname:`, `datetime_format:`, `formatter:`, `shift_period_suffix:`. The latter allows specifying suffix for filenames on log rotation. Discussions: <a class="tracker feature" href="https://bugs.ruby-lang.org/issues/12224">Feature #12224</a> (keyword args), <a class="tracker feature" href="https://bugs.ruby-lang.org/issues/10772">Feature #10772</a> (`shift_period_suffix`).
732+
* <a class="ruby-doc" href="https://ruby-doc.org/stdlib-2.4.0/libdoc/logger/rdoc/Logger.html#method-c-new"><code>Logger.new</code></a> adds keyword arguments `level:`, `progname:`, `datetime_format:`, `formatter:`, `shift_period_suffix:`. The latter allows specifying suffix for filenames on log rotation. Discussions: <a class="tracker feature" href="https://bugs.ruby-lang.org/issues/12224">Feature #12224</a> (keyword args), <a class="tracker feature" href="https://bugs.ruby-lang.org/issues/10772">Feature #10772</a> (`shift_period_suffix`).
733733
* <a class="ruby-doc" href="https://ruby-doc.org/stdlib-2.4.0/libdoc/net/http/rdoc/Net/HTTP.html#method-c-post"><code>Net::HTTP.post</code></a> shortcut method. Discussion: <a class="tracker feature" href="https://bugs.ruby-lang.org/issues/12375">Feature #12375</a>
734734
* `Net::FTP`:
735735
* Support TLS.

2.6.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ Several enumerators can now be chained into one with `Enumerator#+(other)` or `E
433433

434434
* **Reason:** Since Ruby 2.5, these exception classes were "introspectable": when you catch them, you can fetch the object that caused the problem and (in case of `KeyError`) problematic key; but there were no way to add that helpful data when raising an exception in your own code.
435435
* **Discussion:** <a class="tracker feature" href="https://bugs.ruby-lang.org/issues/14313">Feature #14313</a>
436-
* **Documentation:** <a class="ruby-doc" href="https://ruby-doc.org/core-2.6/NameError.html#method-c-new"><code>NameError::new</code></a>, <a class="ruby-doc" href="https://ruby-doc.org/core-2.6/NoMethodError.html#method-c-new"><code>NoMethodError::new</code></a> _(docs not updated)_, <a class="ruby-doc" href="https://ruby-doc.org/core-2.6/KeyError.html#method-c-new"><code>KeyError::new</code></a>
436+
* **Documentation:** <a class="ruby-doc" href="https://ruby-doc.org/core-2.6/NameError.html#method-c-new"><code>NameError.new</code></a>, <a class="ruby-doc" href="https://ruby-doc.org/core-2.6/NoMethodError.html#method-c-new"><code>NoMethodError.new</code></a> _(docs not updated)_, <a class="ruby-doc" href="https://ruby-doc.org/core-2.6/KeyError.html#method-c-new"><code>KeyError.new</code></a>
437437
* **Code:**
438438
```ruby
439439
class MyFancyCollection

3.1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ The method allows to check whether the `Struct`-produced class is initialized by
736736

737737
* **Reason:** Helpful for meta-programming and generic processing of data, like serializing/deserializing.
738738
* **Discussion:** <a class="tracker feature" href="https://bugs.ruby-lang.org/issues/18008">Feature #18008</a>
739-
* **Documentation:** <a class="ruby-doc" href="https://docs.ruby-lang.org/en/3.1/Struct.html#method-c-keyword_init-3F"><code>Strict::keyword_init?</code></a>
739+
* **Documentation:** <a class="ruby-doc" href="https://docs.ruby-lang.org/en/3.1/Struct.html#method-c-keyword_init-3F"><code>Strict.keyword_init?</code></a>
740740
* **Code:**
741741
```ruby
742742
Struct.new(:name, :age).keyword_init? #=> nil

_src/2.4.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ When string is created for usage as a mutable buffer for some large textual data
347347

348348
* **Reason:** Ruby's mutable strings, when used for sequential building of some large text, cause constant reallocations of bigger and bigger memory buffer. By specifying expected capacity beforehand, one can avoid this reallocations.
349349
* **Discussion:** [Feature #12024](https://bugs.ruby-lang.org/issues/12024)
350-
* **Documentation:** [String::new](https://ruby-doc.org/core-2.4.0/String.html#method-c-new)
350+
* **Documentation:** [String.new](https://ruby-doc.org/core-2.4.0/String.html#method-c-new)
351351
* **Code:**
352352
```ruby
353353
s = String.new(capacity: 10_000_000)
@@ -628,7 +628,7 @@ In all contexts where input is split into lines, or received line-by-line, new o
628628
* **Discussion:** [Feature #12553](https://bugs.ruby-lang.org/issues/12553)
629629
* **Documentation** (feature introduced in 2.4, but comprehensive docs were written in 2.5-2.6):
630630
* [String#each_line](https://ruby-doc.org/core-2.5.0/String.html#method-i-each_line), [String#lines](https://ruby-doc.org/core-2.6/String.html#method-i-lines),
631-
* [IO#gets](https://ruby-doc.org/core-2.5.0/IO.html#method-i-gets), [IO#readline](https://ruby-doc.org/core-2.5.0/IO.html#method-i-readline), [IO#readlines](https://ruby-doc.org/core-2.5.0/IO.html#method-i-readline), [IO::foreach](https://ruby-doc.org/core-2.5.0/IO.html#method-c-foreach), [IO::readlines](https://ruby-doc.org/core-2.5.0/IO.html#method-c-readlines),
631+
* [IO#gets](https://ruby-doc.org/core-2.5.0/IO.html#method-i-gets), [IO#readline](https://ruby-doc.org/core-2.5.0/IO.html#method-i-readline), [IO#readlines](https://ruby-doc.org/core-2.5.0/IO.html#method-i-readline), [IO.foreach](https://ruby-doc.org/core-2.5.0/IO.html#method-c-foreach), [IO.readlines](https://ruby-doc.org/core-2.5.0/IO.html#method-c-readlines),
632632
* _Standard library: methods of the class affected, but no documentation for the change:_ [StringIO#gets](https://ruby-doc.org/stdlib-2.4.0/libdoc/stringio/rdoc/StringIO.html#method-i-gets), [StringIO#each_line](https://ruby-doc.org/stdlib-2.4.0/libdoc/stringio/rdoc/StringIO.html#method-i-each_line), [StringIO#readlines](https://ruby-doc.org/stdlib-2.4.0/libdoc/stringio/rdoc/StringIO.html#method-i-readlines)
633633
* **Code:**
634634
```ruby
@@ -727,9 +727,9 @@ Returns an actual name of the method being called, even if aliased.
727727
## Stdlib
728728

729729
* `Set`: [#compare_by_identity](https://ruby-doc.org/stdlib-2.4.0/libdoc/set/rdoc/Set.html#method-i-compare_by_identity) and [#compare_by_identity?](https://ruby-doc.org/stdlib-2.4.0/libdoc/set/rdoc/Set.html#method-i-compare_by_identity-3F) methods added, behaving the same way as (existing since 1.9) [Hash#compare_by_identity](https://ruby-doc.org/core-2.4.0/Hash.html#method-i-compare_by_identity): only elements being the same object (same `#object_id`) are considered same set element. Discussion: [Feature #12210](https://bugs.ruby-lang.org/issues/12210)
730-
* [CSV::new](https://ruby-doc.org/stdlib-2.4.0/libdoc/csv/rdoc/CSV.html#method-c-new): Add a `liberal_parsing` option, allowing to (try to) parse not-completely-valid CSV. Discussion: [Feature #11839](https://bugs.ruby-lang.org/issues/11839)
730+
* [CSV.new](https://ruby-doc.org/stdlib-2.4.0/libdoc/csv/rdoc/CSV.html#method-c-new): Add a `liberal_parsing` option, allowing to (try to) parse not-completely-valid CSV. Discussion: [Feature #11839](https://bugs.ruby-lang.org/issues/11839)
731731
* `Binding#irb` start a REPL session like `binding.pry`.Follow-up: since [Ruby 2.5](https://rubyreferences.github.io/rubychanges/2.5.html#ruby-development-and-introspection), `require 'irb'` is not necessary for the feature to work, it is done automatically.
732-
* [Logger::new](https://ruby-doc.org/stdlib-2.4.0/libdoc/logger/rdoc/Logger.html#method-c-new) adds keyword arguments `level:`, `progname:`, `datetime_format:`, `formatter:`, `shift_period_suffix:`. The latter allows specifying suffix for filenames on log rotation. Discussions: [Feature #12224](https://bugs.ruby-lang.org/issues/12224) (keyword args), [Feature #10772](https://bugs.ruby-lang.org/issues/10772) (`shift_period_suffix`).
732+
* [Logger.new](https://ruby-doc.org/stdlib-2.4.0/libdoc/logger/rdoc/Logger.html#method-c-new) adds keyword arguments `level:`, `progname:`, `datetime_format:`, `formatter:`, `shift_period_suffix:`. The latter allows specifying suffix for filenames on log rotation. Discussions: [Feature #12224](https://bugs.ruby-lang.org/issues/12224) (keyword args), [Feature #10772](https://bugs.ruby-lang.org/issues/10772) (`shift_period_suffix`).
733733
* [Net::HTTP.post](https://ruby-doc.org/stdlib-2.4.0/libdoc/net/http/rdoc/Net/HTTP.html#method-c-post) shortcut method. Discussion: [Feature #12375](https://bugs.ruby-lang.org/issues/12375)
734734
* `Net::FTP`:
735735
* Support TLS.

_src/2.6.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ Several enumerators can now be chained into one with `Enumerator#+(other)` or `E
433433

434434
* **Reason:** Since Ruby 2.5, these exception classes were "introspectable": when you catch them, you can fetch the object that caused the problem and (in case of `KeyError`) problematic key; but there were no way to add that helpful data when raising an exception in your own code.
435435
* **Discussion:** [Feature #14313](https://bugs.ruby-lang.org/issues/14313)
436-
* **Documentation:** [NameError::new](https://ruby-doc.org/core-2.6/NameError.html#method-c-new), [NoMethodError::new](https://ruby-doc.org/core-2.6/NoMethodError.html#method-c-new) _(docs not updated)_, [KeyError::new](https://ruby-doc.org/core-2.6/KeyError.html#method-c-new)
436+
* **Documentation:** [NameError.new](https://ruby-doc.org/core-2.6/NameError.html#method-c-new), [NoMethodError.new](https://ruby-doc.org/core-2.6/NoMethodError.html#method-c-new) _(docs not updated)_, [KeyError.new](https://ruby-doc.org/core-2.6/KeyError.html#method-c-new)
437437
* **Code:**
438438
```ruby
439439
class MyFancyCollection

_src/3.1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ The method allows to check whether the `Struct`-produced class is initialized by
736736

737737
* **Reason:** Helpful for meta-programming and generic processing of data, like serializing/deserializing.
738738
* **Discussion:** [Feature #18008](https://bugs.ruby-lang.org/issues/18008)
739-
* **Documentation:** [Strict::keyword_init?](https://docs.ruby-lang.org/en/3.1/Struct.html#method-c-keyword_init-3F)
739+
* **Documentation:** [Strict.keyword_init?](https://docs.ruby-lang.org/en/3.1/Struct.html#method-c-keyword_init-3F)
740740
* **Code:**
741741
```ruby
742742
Struct.new(:name, :age).keyword_init? #=> nil

_src/evolution.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ Included in many classes to implement comparison methods. Once class defines a m
427427
'Straße'.upcase # => 'STRASSE'
428428
'İzmir'.upcase(:turkic) # => İZMİR -- locale-specific case conversion
429429
```
430-
* [2.4](2.4.md#stringnewcapacity-size) [String::new](https://ruby-doc.org/core-2.4.0/String.html#method-c-new): `capacity:` argument to pre-allocate memory if it is known the string will grow
430+
* [2.4](2.4.md#stringnewcapacity-size) [String.new](https://ruby-doc.org/core-2.4.0/String.html#method-c-new): `capacity:` argument to pre-allocate memory if it is known the string will grow
431431
* [2.4](2.4.md#casecmp) [String#casecmp?](https://ruby-doc.org/core-2.4.0/String.html#method-i-casecmp-3F), [Symbol#casecmp?](https://ruby-doc.org/core-2.4.0/Symbol.html#method-i-casecmp-3F) as a more expressive version of `#casecmp` when boolean value is needed (`#casecmp` returns `-1`/`0`/`1`):
432432
```ruby
433433
'FOO'.casecmp?('foo') # => true
@@ -470,7 +470,7 @@ Included in many classes to implement comparison methods. Once class defines a m
470470
User.new(name: 'Matz', email: 'matz@ruby-lang.org')
471471
```
472472
* [3.1](3.1.md#warning-on-passing-keywords-to-a-non-keyword-initialized-struct) Warning on passing keywords to a non-keyword-initialized struct
473-
* [3.1](3.1.md#structclasskeyword_init) [Strict::keyword_init?](https://docs.ruby-lang.org/en/3.1/Struct.html#method-c-keyword_init-3F)
473+
* [3.1](3.1.md#structclasskeyword_init) [Strict.keyword_init?](https://docs.ruby-lang.org/en/3.1/Struct.html#method-c-keyword_init-3F)
474474

475475
## `Time`
476476

@@ -782,7 +782,7 @@ This section covers exception raising/handling behavior changes, as well as chan
782782
* [2.6](2.6.md#else-in-exception-handling-context) `else` in exception-handling context without any `rescue` is prohibited.
783783
* [2.6](2.6.md#numeric-methods-have-exception-argument) [#Integer()](https://ruby-doc.org/core-2.6/Kernel.html#method-i-Integer) and other similar conversion methods now have optional argument `exception: true/false`, defining whether to raise error on input that can't be converted or just return `nil`
784784
* [2.6](2.6.md#system-has-exception-argument) [#system](https://ruby-doc.org/core-2.6/Kernel.html#method-i-system): optional argument `exception: true/false`
785-
* [2.6](2.6.md#new-arguments-receiver-and-key) New arguments: `receiver:` for [NameError::new](https://ruby-doc.org/core-2.6/NameError.html#method-c-new) and [NoMethodError::new](https://ruby-doc.org/core-2.6/NoMethodError.html#method-c-new); `key:` for [KeyError::new](https://ruby-doc.org/core-2.6/KeyError.html#method-c-new). It allows user code to construct errors with the same level of detail the language can.
785+
* [2.6](2.6.md#new-arguments-receiver-and-key) New arguments: `receiver:` for [NameError.new](https://ruby-doc.org/core-2.6/NameError.html#method-c-new) and [NoMethodError.new](https://ruby-doc.org/core-2.6/NoMethodError.html#method-c-new); `key:` for [KeyError.new](https://ruby-doc.org/core-2.6/KeyError.html#method-c-new). It allows user code to construct errors with the same level of detail the language can.
786786
* [2.6](2.6.md#exceptionfull_message-options) [Exception#full_message](https://ruby-doc.org/core-2.6/Exception.html#method-i-full_message): formatting options `highlight:` and `order:` added
787787
* [2.7](2.7.md#frozenerror-receiver-argument) [FrozenError#new](https://ruby-doc.org/core-2.7.0/FrozenError.html#method-c-new): receiver argument
788788
* [3.1](3.1.md#threadbacktracelimit) [Thread::Backtrace.limit](https://docs.ruby-lang.org/en/3.1/Thread/Backtrace.html#method-c-limit) reader to get the maximum backtrace size set with `--backtrace-limit` command-line option

0 commit comments

Comments
 (0)