Skip to content

Commit

Permalink
Site updated to 573c486
Browse files Browse the repository at this point in the history
  • Loading branch information
janlelis committed Dec 28, 2023
1 parent cb18804 commit d975ad9
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 22 deletions.
4 changes: 3 additions & 1 deletion 26-file-encoding-magic.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ <h1 class="post-heading" id="top"><a href="/26-file-encoding-magic.html">File En

<h2 id="respecting-the-encoding-comment-when-reading-a-file">Respecting the Encoding Comment when Reading a File</h2>

<p><strong>REMOVED IN RUBY 3.3!</strong></p>

<p>You might come across a situation, where you want to read in a source file using Ruby's <a href="https://ruby-doc.org/core/File.html">File</a> class, but also want to set the proper encoding from the magic comment. Fortunately, Ruby's standard library supports this. Unfortunately, it is not a stand-alone module, but a part of IRB:</p>

<pre><code>&gt;&gt; require 'irb/magic-file'
Expand Down Expand Up @@ -77,7 +79,7 @@ <h2>More Idiosyncratic Ruby</h2>
<a href="https://janlelis.com/data-protection.html">Data Protection</a>
</div>
About Core, Encoding, Stdlib<br>
Last Update: December 28, 2018
Last Update: November 10, 2023
</footer>
</div>
<script src="/javascripts/rainbow-custom.min.js" type="text/javascript"></script>
Expand Down
38 changes: 28 additions & 10 deletions 53-the-constant-tree.html
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,19 @@ <h1 class="post-heading" id="top"><a href="/53-the-constant-tree.html">The Const
│ ├─OPTS (Array)
│ └─Profiler (Module)
├─Gem (Module)
│ ├─BUNDLED_GEMS (Module)
│ │ ├─ARCHDIR (String)
│ │ ├─DLEXT (Regexp)
│ │ ├─EXACT (Hash)
│ │ ├─LIBDIR (String)
│ │ ├─LIBEXT (Regexp)
│ │ ├─PREFIXED (Hash)
│ │ ├─SINCE (Hash)
│ │ └─WARNED (Hash)
│ ├─BasicSpecification (Class)
│ ├─CIDetector (Module)
│ │ ├─ENV_DESCRIPTORS (Hash)
│ │ └─ENV_INDICATORS (Array)
│ ├─CommandLineError (Class)
│ ├─ConfigFile (Class)
│ │ ├─DEFAULT_BACKTRACE (TrueClass)
Expand Down Expand Up @@ -736,11 +748,15 @@ <h1 class="post-heading" id="top"><a href="/53-the-constant-tree.html">The Const
│ ├─InvalidSpecificationException (Class)
│ ├─LOADED_SPECS_MUTEX (Thread::Mutex)
│ ├─Licenses (Class)
│ │ ├─DEPRECATED_EXCEPTION_IDENTIFIERS (Array)
│ │ ├─DEPRECATED_EXCEPTION_REGEXP (Regexp)
│ │ ├─DEPRECATED_LICENSE_IDENTIFIERS (Array)
│ │ ├─DEPRECATED_LICENSE_REGEXP (Regexp)
│ │ ├─EXCEPTION_IDENTIFIERS (Array)
│ │ ├─LICENSE_IDENTIFIERS (Array)
│ │ ├─LICENSE_REF (String)
│ │ ├─NONSTANDARD (String)
│ │ └─REGEXP (Regexp)
│ │ └─VALID_REGEXP (Regexp)
│ ├─List (Class)
│ ├─LoadError (Class)
│ ├─MARSHAL_SPEC_DIR (String)
Expand Down Expand Up @@ -780,7 +796,7 @@ <h1 class="post-heading" id="top"><a href="/53-the-constant-tree.html">The Const
│ │ ├─OPS (Hash)
│ │ ├─PATTERN (Regexp)
│ │ ├─PATTERN_RAW (String)
│ │ └─SOURCE_SET_REQUIREMENT (#&lt;Class:0x00007fa3e591f330&gt;)
│ │ └─SOURCE_SET_REQUIREMENT (#&lt;Class:0x00007fa4ce6f7a00&gt;)
│ ├─Resolver (Class)
│ │ ├─APISet (Class)
│ │ │ └─GemParser (Class)
Expand Down Expand Up @@ -863,7 +879,7 @@ <h1 class="post-heading" id="top"><a href="/53-the-constant-tree.html">The Const
│ │ ├─LATEST_RUBY_WITHOUT_PATCH_VERSIONS (Gem::Version)
│ │ ├─MARSHAL_FIELDS (Hash)
│ │ ├─NONEXISTENT_SPECIFICATION_VERSION (Integer)
│ │ ├─NOT_FOUND (#&lt;Class:0x00007fa3e591ecf0&gt;)
│ │ ├─NOT_FOUND (#&lt;Class:0x00007fa4ce6f6060&gt;)
│ │ ├─REMOVED_METHODS (Array)
│ │ ├─SPECIFICATION_VERSION_HISTORY (Hash)
│ │ ├─TODAY (Time)
Expand All @@ -884,7 +900,6 @@ <h1 class="post-heading" id="top"><a href="/53-the-constant-tree.html">The Const
│ │ ├─REQUIRE_PATHS (Hash)
│ │ └─REQUIRE_PATH_LIST (Hash)
│ ├─SystemExitException (Class)
│ ├─UNTAINT (Proc)
│ ├─UninstallError (Class)
│ ├─UnknownCommandError (Class)
│ ├─UnknownCommandSpellChecker (Class)
Expand All @@ -902,9 +917,10 @@ <h1 class="post-heading" id="top"><a href="/53-the-constant-tree.html">The Const
│ │ │ ├─OPS (Hash)
│ │ │ ├─PATTERN (Regexp)
│ │ │ ├─PATTERN_RAW (String)
│ │ │ └─SOURCE_SET_REQUIREMENT (#&lt;Class:0x00007fa3e591f330&gt;)
│ │ │ └─SOURCE_SET_REQUIREMENT (#&lt;Class:0x00007fa4ce6f7a00&gt;)
│ │ └─VERSION_PATTERN (String)
│ └─WIN_PATTERNS (Array)
│ ├─WIN_PATTERNS (Array)
│ └─WebauthnVerificationError (Class)
├─Hash (Class)
├─IO (Class)
│ ├─Buffer (Class)
Expand Down Expand Up @@ -977,6 +993,7 @@ <h1 class="post-heading" id="top"><a href="/53-the-constant-tree.html">The Const
├─Numeric (Class)
├─Object → Object
├─ObjectSpace (Module)
│ ├─WeakKeyMap (Class)
│ └─WeakMap (Class)
├─Proc (Class)
├─Process (Module)
Expand Down Expand Up @@ -1065,16 +1082,17 @@ <h1 class="post-heading" id="top"><a href="/53-the-constant-tree.html">The Const
│ ├─DEFAULT_PARAMS (Hash)
│ ├─INSTRUCTION_NAMES (Array)
│ ├─InstructionSequence (Class)
│ ├─MJIT (Module)
│ └─OPTS (Array)
│ ├─OPTS (Array)
│ └─RJIT (Module)
├─RuntimeError (Class)
├─STDERR (IO)
├─STDIN (IO)
├─STDOUT (IO)
├─ScriptError (Class)
├─SecurityError (Class)
├─Set (Class)
│ └─InspectKey (Symbol)
│ ├─InspectKey (Symbol)
│ └─VERSION (String)
├─Signal (Module)
├─SignalException (Class)
├─SizedQueue (Class)
Expand Down Expand Up @@ -1159,7 +1177,7 @@ <h2>More Idiosyncratic Ruby</h2>
<a href="https://janlelis.com/data-protection.html">Data Protection</a>
</div>
About Core, Constants<br>
Last Update: April 08, 2023
Last Update: December 27, 2023
</footer>
</div>
<script src="/javascripts/rainbow-custom.min.js" type="text/javascript"></script>
Expand Down
10 changes: 9 additions & 1 deletion 73-unicode-version-mapping.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ <h2 id="ruby--unicode">Ruby / Unicode</h2>
</tr>
</thead>
<tbody>
<tr>
<td><strong>3.3</strong></td>
<td><strong>15.0.0</strong></td>
</tr>
<tr>
<td><strong>3.2</strong></td>
<td><strong>15.0.0</strong></td>
Expand Down Expand Up @@ -116,6 +120,10 @@ <h2 id="ruby--emoji">Ruby / Emoji</h2>
</tr>
</thead>
<tbody>
<tr>
<td><strong>3.3</strong></td>
<td><strong>15.0</strong></td>
</tr>
<tr>
<td><strong>3.2</strong></td>
<td><strong>15.0</strong></td>
Expand Down Expand Up @@ -176,7 +184,7 @@ <h2>More Idiosyncratic Ruby</h2>
<a href="https://janlelis.com/data-protection.html">Data Protection</a>
</div>
About Regex, Unicode<br>
Last Update: December 25, 2022
Last Update: December 27, 2023
</footer>
</div>
<script src="/javascripts/rainbow-custom.min.js" type="text/javascript"></script>
Expand Down
46 changes: 37 additions & 9 deletions feed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,10 @@ test! # =&amp;gt; [:example!, :test!]
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;3.3&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;15.0.0&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;3.2&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;15.0.0&lt;/strong&gt;&lt;/td&gt;
Expand Down Expand Up @@ -963,6 +967,10 @@ test! # =&amp;gt; [:example!, :test!]
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;3.3&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;15.0&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;3.2&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;15.0&lt;/strong&gt;&lt;/td&gt;
Expand Down Expand Up @@ -15913,7 +15921,19 @@ Array.try_convert(o) # =&amp;gt; [42]
│ ├─OPTS (Array)
│ └─Profiler (Module)
├─Gem (Module)
│ ├─BUNDLED_GEMS (Module)
│ │ ├─ARCHDIR (String)
│ │ ├─DLEXT (Regexp)
│ │ ├─EXACT (Hash)
│ │ ├─LIBDIR (String)
│ │ ├─LIBEXT (Regexp)
│ │ ├─PREFIXED (Hash)
│ │ ├─SINCE (Hash)
│ │ └─WARNED (Hash)
│ ├─BasicSpecification (Class)
│ ├─CIDetector (Module)
│ │ ├─ENV_DESCRIPTORS (Hash)
│ │ └─ENV_INDICATORS (Array)
│ ├─CommandLineError (Class)
│ ├─ConfigFile (Class)
│ │ ├─DEFAULT_BACKTRACE (TrueClass)
Expand Down Expand Up @@ -15955,11 +15975,15 @@ Array.try_convert(o) # =&amp;gt; [42]
│ ├─InvalidSpecificationException (Class)
│ ├─LOADED_SPECS_MUTEX (Thread::Mutex)
│ ├─Licenses (Class)
│ │ ├─DEPRECATED_EXCEPTION_IDENTIFIERS (Array)
│ │ ├─DEPRECATED_EXCEPTION_REGEXP (Regexp)
│ │ ├─DEPRECATED_LICENSE_IDENTIFIERS (Array)
│ │ ├─DEPRECATED_LICENSE_REGEXP (Regexp)
│ │ ├─EXCEPTION_IDENTIFIERS (Array)
│ │ ├─LICENSE_IDENTIFIERS (Array)
│ │ ├─LICENSE_REF (String)
│ │ ├─NONSTANDARD (String)
│ │ └─REGEXP (Regexp)
│ │ └─VALID_REGEXP (Regexp)
│ ├─List (Class)
│ ├─LoadError (Class)
│ ├─MARSHAL_SPEC_DIR (String)
Expand Down Expand Up @@ -15999,7 +16023,7 @@ Array.try_convert(o) # =&amp;gt; [42]
│ │ ├─OPS (Hash)
│ │ ├─PATTERN (Regexp)
│ │ ├─PATTERN_RAW (String)
│ │ └─SOURCE_SET_REQUIREMENT (#&amp;lt;Class:0x00007fa3e591f330&amp;gt;)
│ │ └─SOURCE_SET_REQUIREMENT (#&amp;lt;Class:0x00007fa4ce6f7a00&amp;gt;)
│ ├─Resolver (Class)
│ │ ├─APISet (Class)
│ │ │ └─GemParser (Class)
Expand Down Expand Up @@ -16082,7 +16106,7 @@ Array.try_convert(o) # =&amp;gt; [42]
│ │ ├─LATEST_RUBY_WITHOUT_PATCH_VERSIONS (Gem::Version)
│ │ ├─MARSHAL_FIELDS (Hash)
│ │ ├─NONEXISTENT_SPECIFICATION_VERSION (Integer)
│ │ ├─NOT_FOUND (#&amp;lt;Class:0x00007fa3e591ecf0&amp;gt;)
│ │ ├─NOT_FOUND (#&amp;lt;Class:0x00007fa4ce6f6060&amp;gt;)
│ │ ├─REMOVED_METHODS (Array)
│ │ ├─SPECIFICATION_VERSION_HISTORY (Hash)
│ │ ├─TODAY (Time)
Expand All @@ -16103,7 +16127,6 @@ Array.try_convert(o) # =&amp;gt; [42]
│ │ ├─REQUIRE_PATHS (Hash)
│ │ └─REQUIRE_PATH_LIST (Hash)
│ ├─SystemExitException (Class)
│ ├─UNTAINT (Proc)
│ ├─UninstallError (Class)
│ ├─UnknownCommandError (Class)
│ ├─UnknownCommandSpellChecker (Class)
Expand All @@ -16121,9 +16144,10 @@ Array.try_convert(o) # =&amp;gt; [42]
│ │ │ ├─OPS (Hash)
│ │ │ ├─PATTERN (Regexp)
│ │ │ ├─PATTERN_RAW (String)
│ │ │ └─SOURCE_SET_REQUIREMENT (#&amp;lt;Class:0x00007fa3e591f330&amp;gt;)
│ │ │ └─SOURCE_SET_REQUIREMENT (#&amp;lt;Class:0x00007fa4ce6f7a00&amp;gt;)
│ │ └─VERSION_PATTERN (String)
│ └─WIN_PATTERNS (Array)
│ ├─WIN_PATTERNS (Array)
│ └─WebauthnVerificationError (Class)
├─Hash (Class)
├─IO (Class)
│ ├─Buffer (Class)
Expand Down Expand Up @@ -16196,6 +16220,7 @@ Array.try_convert(o) # =&amp;gt; [42]
├─Numeric (Class)
├─Object → Object
├─ObjectSpace (Module)
│ ├─WeakKeyMap (Class)
│ └─WeakMap (Class)
├─Proc (Class)
├─Process (Module)
Expand Down Expand Up @@ -16284,16 +16309,17 @@ Array.try_convert(o) # =&amp;gt; [42]
│ ├─DEFAULT_PARAMS (Hash)
│ ├─INSTRUCTION_NAMES (Array)
│ ├─InstructionSequence (Class)
│ ├─MJIT (Module)
│ └─OPTS (Array)
│ ├─OPTS (Array)
│ └─RJIT (Module)
├─RuntimeError (Class)
├─STDERR (IO)
├─STDIN (IO)
├─STDOUT (IO)
├─ScriptError (Class)
├─SecurityError (Class)
├─Set (Class)
│ └─InspectKey (Symbol)
│ ├─InspectKey (Symbol)
│ └─VERSION (String)
├─Signal (Module)
├─SignalException (Class)
├─SizedQueue (Class)
Expand Down Expand Up @@ -22377,6 +22403,8 @@ p "".encoding #=&amp;gt; #&amp;lt;Encoding:Windows-1252&amp;gt;

&lt;h2 id="respecting-the-encoding-comment-when-reading-a-file"&gt;Respecting the Encoding Comment when Reading a File&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;REMOVED IN RUBY 3.3!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You might come across a situation, where you want to read in a source file using Ruby's &lt;a href="https://ruby-doc.org/core/File.html"&gt;File&lt;/a&gt; class, but also want to set the proper encoding from the magic comment. Fortunately, Ruby's standard library supports this. Unfortunately, it is not a stand-alone module, but a part of IRB:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt; require 'irb/magic-file'
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ <h3 id="ruby-moves-on">Ruby Moves On</h3>
The aim of <em>Idiosyncratic Ruby</em> is to document lesser-known features of Ruby as a series of blog posts. All the content is on <a href="https://github.com/janlelis/idiosyncratic-ruby.com">GitHub</a>, enabling it to live beyond its publish date.
</p>

<p>Last update to an article: April 08, 2023 </p>
<p>Last update to an article: December 27, 2023 </p>
</section>
<section>
<h3 id="related-projects">Related Projects</h3>
Expand Down

0 comments on commit d975ad9

Please sign in to comment.