Skip to content

Commit

Permalink
Merge 8b6f243 into f16e29d
Browse files Browse the repository at this point in the history
  • Loading branch information
marian13 committed Apr 16, 2020
2 parents f16e29d + 8b6f243 commit 36b2c58
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 203 deletions.
198 changes: 3 additions & 195 deletions docs/classes/BasicTemperature/Temperature.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<meta name="keywords" content="BasicTemperature::Temperature class">

<meta name="keywords" content="[], new, set_degrees, set_scale, to_scale, to_celsius, to_fahrenheit, to_kelvin, to_rankine, <=>, +, -, -@, boil_water?, freeze_water?">
<meta name="keywords" content="[], new, set_degrees, set_scale, to_scale, to_celsius, to_fahrenheit, to_kelvin, to_rankine, <=>, boil_water?, freeze_water?">

</head>

Expand Down Expand Up @@ -312,21 +312,6 @@ <h2 id="class-BasicTemperature::Temperature-label-Queries">Queries</h2>
<ul>


<li>
<a href="#method-i-2B">+</a>,
</li>


<li>
<a href="#method-i-2D">-</a>,
</li>


<li>
<a href="#method-i-2D-40">-@</a>,
</li>


<li>
<a href="#method-i-3C-3D-3E">&lt;=&gt;</a>,
</li>
Expand Down Expand Up @@ -687,183 +672,6 @@ <h2 id="class-BasicTemperature::Temperature-label-Queries">Queries</h2>

<div class="sectiontitle">Instance Public methods</div>

<div class="method">
<div class="title method-title" id="method-i-2B">

<b>+(temperature)<br />+(numeric)</b>

<a href="../../classes/BasicTemperature/Temperature.html#method-i-2B" name="method-i-2B" class="permalink">Link</a>
</div>


<div class="description">
<p>Performs addition. Returns a new <a href="Temperature.html"><code>Temperature</code></a>.</p>

<pre><code>Temperature[20, :celsius] + Temperature[10, :celsius]
# =&gt; 30 °C
</code></pre>

<p>If the second temperature has a different scale, the first temperature is automatically converted to that scale before <code>degrees</code> addition.</p>

<pre><code>Temperature[283.15, :kelvin] + Temperature[20, :celsius]
# =&gt; 30 °C
</code></pre>

<p>Returned temperature will have the same scale as the second temperature.</p>

<p>It is possible to add numerics.</p>

<pre><code>Temperature[20, :celsius] + 10
# =&gt; 30 °C
</code></pre>

<p>In such cases, returned temperature will have the same scale as the first temperature.</p>

<p>Also <a href="https://ruby-doc.org/core/Numeric.html#method-i-coerce">Ruby coersion mechanism</a> is supported.</p>

<pre><code>10 + Temperature[20, :celsius]
# =&gt; 30 °C
</code></pre>
</div>








<div class="sourcecode">

<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-2B_source')" id="l_method-i-2B_source">show</a>

</p>
<div id="method-i-2B_source" class="dyn-source">
<pre><span class="ruby-comment"># File lib/basic_temperature/temperature.rb, line 502</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">+</span>(<span class="ruby-identifier">other</span>)
<span class="ruby-identifier">assert_numeric_or_temperature!</span>(<span class="ruby-identifier">other</span>)

<span class="ruby-identifier">degrees</span>, <span class="ruby-identifier">scale</span> =
<span class="ruby-keyword">case</span> <span class="ruby-identifier">other</span>
<span class="ruby-keyword">when</span> <span class="ruby-constant">Numeric</span>
[<span class="ruby-keyword">self</span>.<span class="ruby-identifier">degrees</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">other</span>, <span class="ruby-keyword">self</span>.<span class="ruby-identifier">scale</span>]
<span class="ruby-keyword">when</span> <span class="ruby-constant">Temperature</span>
[<span class="ruby-keyword">self</span>.<span class="ruby-identifier">to_scale</span>(<span class="ruby-identifier">other</span>.<span class="ruby-identifier">scale</span>).<span class="ruby-identifier">degrees</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">degrees</span>, <span class="ruby-identifier">other</span>.<span class="ruby-identifier">scale</span>]
<span class="ruby-keyword">end</span>

<span class="ruby-constant">Temperature</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">degrees</span>, <span class="ruby-identifier">scale</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>

</div>

<div class="method">
<div class="title method-title" id="method-i-2D">

<b>-(temperature)<br />-(numeric)</b>

<a href="../../classes/BasicTemperature/Temperature.html#method-i-2D" name="method-i-2D" class="permalink">Link</a>
</div>


<div class="description">
<p>Performs subtraction. Returns a new <a href="Temperature.html"><code>Temperature</code></a>.</p>

<pre><code>Temperature[20, :celsius] - Temperature[10, :celsius]
# =&gt; 10 °C
</code></pre>

<p>If the second temperature has a different scale, the first temperature is automatically converted to that scale before <code>degrees</code> subtraction.</p>

<pre><code>Temperature[283.15, :kelvin] + Temperature[10, :celsius]
# =&gt; 10 °C
</code></pre>

<p>Returned temperature will have the same scale as the second temperature.</p>

<p>It is possible to subtract numerics.</p>

<pre><code>Temperature[20, :celsius] - 10
# =&gt; 10 °C
</code></pre>

<p>In such cases, returned temperature will have the same scale as the first temperature.</p>

<p>Also <a href="https://ruby-doc.org/core/Numeric.html#method-i-coerce">Ruby coersion mechanism</a> is supported.</p>

<pre><code>10 - Temperature[20, :celsius]
# =&gt; -10 °C
</code></pre>
</div>








<div class="sourcecode">

<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-2D_source')" id="l_method-i-2D_source">show</a>

</p>
<div id="method-i-2D_source" class="dyn-source">
<pre><span class="ruby-comment"># File lib/basic_temperature/temperature.rb, line 546</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">-</span>(<span class="ruby-identifier">other</span>)
<span class="ruby-keyword">self</span> <span class="ruby-operator">+</span> <span class="ruby-operator">-</span><span class="ruby-identifier">other</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>

</div>

<div class="method">
<div class="title method-title" id="method-i-2D-40">

<b>-@</b>()

<a href="../../classes/BasicTemperature/Temperature.html#method-i-2D-40" name="method-i-2D-40" class="permalink">Link</a>
</div>


<div class="description">
<p>Returns a new <a href="Temperature.html"><code>Temperature</code></a> with negated <code>degrees</code>.</p>

<pre><code>-Temperature[20, :celsius]
# =&gt; -20 °C
</code></pre>
</div>








<div class="sourcecode">

<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-2D-40_source')" id="l_method-i-2D-40_source">show</a>

</p>
<div id="method-i-2D-40_source" class="dyn-source">
<pre><span class="ruby-comment"># File lib/basic_temperature/temperature.rb, line 556</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">-@</span>
<span class="ruby-constant">Temperature</span>.<span class="ruby-identifier">new</span>(<span class="ruby-operator">-</span><span class="ruby-keyword">self</span>.<span class="ruby-identifier">degrees</span>, <span class="ruby-keyword">self</span>.<span class="ruby-identifier">scale</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>

</div>

<div class="method">
<div class="title method-title" id="method-i-3C-3D-3E">

Expand Down Expand Up @@ -964,7 +772,7 @@ <h2 id="class-BasicTemperature::Temperature-label-Queries">Queries</h2>

</p>
<div id="method-i-boil_water-3F_source" class="dyn-source">
<pre><span class="ruby-comment"># File lib/basic_temperature/temperature.rb, line 564</span>
<pre><span class="ruby-comment"># File lib/basic_temperature/temperature.rb, line 476</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">boil_water?</span>
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">to_celsius</span>.<span class="ruby-identifier">degrees</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">100</span>
<span class="ruby-keyword">end</span></pre>
Expand Down Expand Up @@ -1001,7 +809,7 @@ <h2 id="class-BasicTemperature::Temperature-label-Queries">Queries</h2>

</p>
<div id="method-i-freeze_water-3F_source" class="dyn-source">
<pre><span class="ruby-comment"># File lib/basic_temperature/temperature.rb, line 572</span>
<pre><span class="ruby-comment"># File lib/basic_temperature/temperature.rb, line 484</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">freeze_water?</span>
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">to_celsius</span>.<span class="ruby-identifier">degrees</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-value">0</span>
<span class="ruby-keyword">end</span></pre>
Expand Down
8 changes: 4 additions & 4 deletions docs/created.rid
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Wed, 15 Apr 2020 18:28:28 -0000
Thu, 16 Apr 2020 14:45:35 -0000
lib/basic_temperature.rb Thu, 26 Mar 2020 17:27:15 +0200
lib/basic_temperature/temperature.rb Wed, 15 Apr 2020 21:23:59 +0300
lib/basic_temperature/temperature.rb Thu, 16 Apr 2020 17:45:21 +0300
lib/basic_temperature/version.rb Thu, 26 Mar 2020 17:27:15 +0200
lib/basic_temperature/alias.rb Thu, 26 Mar 2020 17:27:15 +0200
lib/basic_temperature/temperature/errors.rb Wed, 15 Apr 2020 20:22:25 +0300
lib/basic_temperature/temperature/errors.rb Thu, 16 Apr 2020 17:45:21 +0300
lib/basic_temperature/temperature/initialization.rb Thu, 26 Mar 2020 17:27:15 +0200
lib/basic_temperature/temperature/casting.rb Thu, 26 Mar 2020 17:27:15 +0200
lib/basic_temperature/temperature/additional_helpers.rb Thu, 26 Mar 2020 17:27:15 +0200
lib/basic_temperature/temperature/rounding.rb Thu, 26 Mar 2020 17:27:15 +0200
lib/basic_temperature/temperature/memoization.rb Thu, 26 Mar 2020 17:27:15 +0200
lib/basic_temperature/temperature/assertions.rb Wed, 15 Apr 2020 20:22:25 +0300
lib/basic_temperature/temperature/assertions.rb Thu, 16 Apr 2020 17:45:21 +0300
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h1>
lib/basic_temperature/temperature/assertions.rb

</li>
<li>Last modified: 2020-04-15 20:22:25 +0300</li>
<li>Last modified: 2020-04-16 17:45:21 +0300</li>
</ul>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h1>
lib/basic_temperature/temperature/errors.rb

</li>
<li>Last modified: 2020-04-15 20:22:25 +0300</li>
<li>Last modified: 2020-04-16 17:45:21 +0300</li>
</ul>
</div>

Expand Down
2 changes: 1 addition & 1 deletion docs/files/lib/basic_temperature/temperature_rb.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h1>
lib/basic_temperature/temperature.rb

</li>
<li>Last modified: 2020-04-15 21:23:59 +0300</li>
<li>Last modified: 2020-04-16 17:45:21 +0300</li>
</ul>
</div>

Expand Down

0 comments on commit 36b2c58

Please sign in to comment.