Skip to content

Commit

Permalink
Additions to Version
Browse files Browse the repository at this point in the history
  • Loading branch information
evanthegrayt committed May 8, 2021
1 parent 4a6347b commit 1f5f507
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 40 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
standup_md (0.3.8)
standup_md (0.3.10)

GEM
remote: https://rubygems.org/
Expand Down
60 changes: 58 additions & 2 deletions doc/StandupMD/Version.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ <h2>
<h3>Methods</h3>

<ul class="link-list" role="directory">
<li ><a href="#method-c-to_a">::to_a</a>
<li ><a href="#method-c-to_h">::to_h</a>
<li ><a href="#method-c-to_s">::to_s</a>
</ul>
</div>
Expand Down Expand Up @@ -94,10 +96,16 @@ <h3>Constants</h3>
<dl>
<dt id="MAJOR">MAJOR
<dd><p>Major version.</p>

<p>@return [Integer]</p>
<dt id="MINOR">MINOR
<dd><p>Minor version.</p>

<p>@return [Integer]</p>
<dt id="PATCH">PATCH
<dd><p>Patch version.</p>

<p>@return [Integer]</p>
</dl>
</section>

Expand All @@ -108,6 +116,52 @@ <h3>Constants</h3>
<h3>Public Class Methods</h3>
</header>

<div id="method-c-to_a" class="method-detail ">
<div class="method-heading">
<span class="method-name">to_a</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>

<div class="method-description">
<p><a href="Version.html"><code>Version</code></a> as +[MAJOR, <a href="Version.html#MINOR"><code>MINOR</code></a>, PATCH]+</p>

<p>@return [Array]</p>

<div class="method-source-code" id="to_a-source">
<pre><span class="ruby-comment"># File lib/standup_md/version.rb, line 30</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">to_a</span>
[<span class="ruby-constant">MAJOR</span>, <span class="ruby-constant">MINOR</span>, <span class="ruby-constant">PATCH</span>]
<span class="ruby-keyword">end</span></pre>
</div>
</div>


</div>

<div id="method-c-to_h" class="method-detail ">
<div class="method-heading">
<span class="method-name">to_h</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>

<div class="method-description">
<p><a href="Version.html"><code>Version</code></a> as +{major: <a href="Version.html#MAJOR"><code>MAJOR</code></a>, minor: <a href="Version.html#MINOR"><code>MINOR</code></a>, patch: PATCH}+</p>

<p>@return [Hash]</p>

<div class="method-source-code" id="to_h-source">
<pre><span class="ruby-comment"># File lib/standup_md/version.rb, line 46</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">to_h</span>
<span class="ruby-constant">Hash</span>[<span class="ruby-node">%i[major minor patch]</span>.<span class="ruby-identifier">zip</span>(<span class="ruby-identifier">to_a</span>)]
<span class="ruby-keyword">end</span></pre>
</div>
</div>


</div>

<div id="method-c-to_s" class="method-detail ">
<div class="method-heading">
<span class="method-name">to_s</span><span
Expand All @@ -118,10 +172,12 @@ <h3>Public Class Methods</h3>
<div class="method-description">
<p><a href="Version.html"><code>Version</code></a> as <code>MAJOR.MINOR.PATCH</code></p>

<p>@return [String]</p>

<div class="method-source-code" id="to_s-source">
<pre><span class="ruby-comment"># File lib/standup_md/version.rb, line 23</span>
<pre><span class="ruby-comment"># File lib/standup_md/version.rb, line 38</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">to_s</span>
<span class="ruby-node">&quot;#{MAJOR}.#{MINOR}.#{PATCH}&quot;</span>
<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39;.&#39;</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions doc/created.rid
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Sat, 08 May 2021 00:03:30 -0500
Sat, 08 May 2021 00:34:36 -0500
README.md Fri, 07 May 2021 17:33:37 -0500
lib/standup_md.rb Fri, 07 May 2021 23:55:13 -0500
lib/standup_md/cli.rb Sat, 08 May 2021 00:01:31 -0500
Expand All @@ -12,4 +12,4 @@ lib/standup_md/entry.rb Fri, 07 May 2021 23:57:15 -0500
lib/standup_md/entry_list.rb Mon, 12 Apr 2021 21:51:46 -0500
lib/standup_md/file.rb Mon, 26 Apr 2021 09:04:06 -0500
lib/standup_md/file/helpers.rb Tue, 13 Oct 2020 21:04:02 -0500
lib/standup_md/version.rb Sat, 08 May 2021 00:03:13 -0500
lib/standup_md/version.rb Sat, 08 May 2021 00:33:30 -0500
2 changes: 1 addition & 1 deletion doc/js/search_index.js

Large diffs are not rendered by default.

Binary file modified doc/js/search_index.js.gz
Binary file not shown.
72 changes: 41 additions & 31 deletions doc/table_of_contents.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,19 @@ <h2 id="methods">Methods</h2>
<ul>

<li class="method">
<a href="StandupMD/EntryList.html#method-c-config">::config</a>
<a href="StandupMD/Cli.html#method-c-config">::config</a>
&mdash;
<span class="container">StandupMD::EntryList</span>
<span class="container">StandupMD::Cli</span>

<li class="method">
<a href="StandupMD/Entry.html#method-c-config">::config</a>
&mdash;
<span class="container">StandupMD::Entry</span>

<li class="method">
<a href="StandupMD/Cli.html#method-c-config">::config</a>
<a href="StandupMD/EntryList.html#method-c-config">::config</a>
&mdash;
<span class="container">StandupMD::Cli</span>
<span class="container">StandupMD::EntryList</span>

<li class="method">
<a href="StandupMD/File.html#method-c-config">::config</a>
Expand Down Expand Up @@ -176,50 +176,60 @@ <h2 id="methods">Methods</h2>
<span class="container">StandupMD</span>

<li class="method">
<a href="StandupMD/Config/Cli.html#method-c-new">::new</a>
&mdash;
<span class="container">StandupMD::Config::Cli</span>

<li class="method">
<a href="StandupMD/Config.html#method-c-new">::new</a>
<a href="StandupMD/File.html#method-c-new">::new</a>
&mdash;
<span class="container">StandupMD::Config</span>
<span class="container">StandupMD::File</span>

<li class="method">
<a href="StandupMD/Config/File.html#method-c-new">::new</a>
&mdash;
<span class="container">StandupMD::Config::File</span>

<li class="method">
<a href="StandupMD/Config/Entry.html#method-c-new">::new</a>
<a href="StandupMD/Cli.html#method-c-new">::new</a>
&mdash;
<span class="container">StandupMD::Config::Entry</span>
<span class="container">StandupMD::Cli</span>

<li class="method">
<a href="StandupMD/File.html#method-c-new">::new</a>
<a href="StandupMD/EntryList.html#method-c-new">::new</a>
&mdash;
<span class="container">StandupMD::File</span>
<span class="container">StandupMD::EntryList</span>

<li class="method">
<a href="StandupMD/Cli.html#method-c-new">::new</a>
<a href="StandupMD/Config/Cli.html#method-c-new">::new</a>
&mdash;
<span class="container">StandupMD::Cli</span>
<span class="container">StandupMD::Config::Cli</span>

<li class="method">
<a href="StandupMD/Entry.html#method-c-new">::new</a>
&mdash;
<span class="container">StandupMD::Entry</span>

<li class="method">
<a href="StandupMD/EntryList.html#method-c-new">::new</a>
<a href="StandupMD/Config/Entry.html#method-c-new">::new</a>
&mdash;
<span class="container">StandupMD::EntryList</span>
<span class="container">StandupMD::Config::Entry</span>

<li class="method">
<a href="StandupMD/Config.html#method-c-new">::new</a>
&mdash;
<span class="container">StandupMD::Config</span>

<li class="method">
<a href="StandupMD.html#method-c-reset_config">::reset_config</a>
&mdash;
<span class="container">StandupMD</span>

<li class="method">
<a href="StandupMD/Version.html#method-c-to_a">::to_a</a>
&mdash;
<span class="container">StandupMD::Version</span>

<li class="method">
<a href="StandupMD/Version.html#method-c-to_h">::to_h</a>
&mdash;
<span class="container">StandupMD::Version</span>

<li class="method">
<a href="StandupMD/Version.html#method-c-to_s">::to_s</a>
&mdash;
Expand Down Expand Up @@ -321,24 +331,24 @@ <h2 id="methods">Methods</h2>
<span class="container">StandupMD::Cli::Helpers</span>

<li class="method">
<a href="StandupMD/Config/Cli.html#method-i-reset">#reset</a>
<a href="StandupMD/Config/File.html#method-i-reset">#reset</a>
&mdash;
<span class="container">StandupMD::Config::Cli</span>
<span class="container">StandupMD::Config::File</span>

<li class="method">
<a href="StandupMD/Config/File.html#method-i-reset">#reset</a>
<a href="StandupMD/Config/Entry.html#method-i-reset">#reset</a>
&mdash;
<span class="container">StandupMD::Config::File</span>
<span class="container">StandupMD::Config::Entry</span>

<li class="method">
<a href="StandupMD/Config/EntryList.html#method-i-reset">#reset</a>
<a href="StandupMD/Config/Cli.html#method-i-reset">#reset</a>
&mdash;
<span class="container">StandupMD::Config::EntryList</span>
<span class="container">StandupMD::Config::Cli</span>

<li class="method">
<a href="StandupMD/Config/Entry.html#method-i-reset">#reset</a>
<a href="StandupMD/Config/EntryList.html#method-i-reset">#reset</a>
&mdash;
<span class="container">StandupMD::Config::Entry</span>
<span class="container">StandupMD::Config::EntryList</span>

<li class="method">
<a href="StandupMD/EntryList.html#method-i-sort">#sort</a>
Expand Down Expand Up @@ -371,14 +381,14 @@ <h2 id="methods">Methods</h2>
<span class="container">StandupMD::EntryList</span>

<li class="method">
<a href="StandupMD/EntryList.html#method-i-to_json">#to_json</a>
<a href="StandupMD/Entry.html#method-i-to_json">#to_json</a>
&mdash;
<span class="container">StandupMD::EntryList</span>
<span class="container">StandupMD::Entry</span>

<li class="method">
<a href="StandupMD/Entry.html#method-i-to_json">#to_json</a>
<a href="StandupMD/EntryList.html#method-i-to_json">#to_json</a>
&mdash;
<span class="container">StandupMD::Entry</span>
<span class="container">StandupMD::EntryList</span>

<li class="method">
<a href="StandupMD/File.html#method-i-write">#write</a>
Expand Down
29 changes: 26 additions & 3 deletions lib/standup_md/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,46 @@ module StandupMD
# Module that contains all gem version information. Follows semantic
# versioning. Read: https://semver.org/
module Version

##
# Major version.
#
# @return [Integer]
MAJOR = 0

##
# Minor version.
#
# @return [Integer]
MINOR = 3

##
# Patch version.
PATCH = 9
#
# @return [Integer]
PATCH = 10

##
# Version as +[MAJOR, MINOR, PATCH]+
#
# @return [Array]
def self.to_a
[MAJOR, MINOR, PATCH]
end

##
# Version as +MAJOR.MINOR.PATCH+
#
# @return [String]
def self.to_s
"#{MAJOR}.#{MINOR}.#{PATCH}"
to_a.join('.')
end

##
# Version as +{major: MAJOR, minor: MINOR, patch: PATCH}+
#
# @return [Hash]
def self.to_h
Hash[%i[major minor patch].zip(to_a)]
end
end
end
22 changes: 22 additions & 0 deletions test/standup_md/version_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,28 @@
require_relative '../../lib/standup_md'

class TestVersion < TestHelper
def test_to_a
assert_equal(
[
StandupMD::Version::MAJOR,
StandupMD::Version::MINOR,
StandupMD::Version::PATCH
],
StandupMD::Version.to_a
)
end

def test_to_h
assert_equal(
{
major: StandupMD::Version::MAJOR,
minor: StandupMD::Version::MINOR,
patch: StandupMD::Version::PATCH
},
StandupMD::Version.to_h
)
end

def test_to_s
assert_match(/\d+\.\d+.\d+/, StandupMD::Version.to_s)
end
Expand Down

0 comments on commit 1f5f507

Please sign in to comment.