sass-site/source/documentation/Sass/Version.html
2018-10-22 14:13:05 -07:00

331 lines
17 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
Module: Sass::Version
&mdash; Documentation by YARD 0.9.12
</title>
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="../../assets/css/docs.css" type="text/css" charset="utf-8" />
<script type="text/javascript" charset="utf-8">
hasFrames = window.top.frames.main ? true : false;
relpath = '../';
framesUrl = "../frames.html#!Sass/Version.html";
</script>
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
</head>
<body>
<div id="header">
<div id="menu">
<a href="../_index.html">Index (V)</a> &raquo;
<span class='title'><span class='object_link'><a href="../Sass.html" title="Sass (module)">Sass</a></span></span>
&raquo;
<span class="title">Version</span>
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="../class_list.html">
Class List
</a>
<a class="full_list_link" id="method_list_link"
href="../method_list.html">
Method List
</a>
<a class="full_list_link" id="file_list_link"
href="../file_list.html">
File List
</a>
</div>
<div class="clear"></div>
</div>
<iframe id="search_frame"></iframe>
<div id="content"><h1>Module: Sass::Version
</h1>
<dl class="box">
<dt class="r1">Included in:</dt>
<dd class="r1"><span class='object_link'><a href="../Sass.html" title="Sass (module)">Sass</a></span></dd>
<dt class="r2 last">Defined in:</dt>
<dd class="r2 last">.ruby-sass/lib/sass/version.rb</dd>
</dl>
<div class="clear"></div>
<h2>Overview</h2><div class="docstring">
<div class="discussion">
<p>Handles Sass version-reporting. Sass not only reports the standard three
version numbers, but its Git revision hash as well, if it was installed
from Git.</p>
</div>
</div>
<div class="tags">
</div>
<h2>
Instance Method Summary
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#version-instance_method" title="#version (instance method)">#<strong>version</strong> &#x21d2; {Symbol =&gt; String/Integer} </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns a hash representing the version of Sass.</p>
</div></span>
</li>
</ul>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="version-instance_method">
#<strong>version</strong> &#x21d2; <tt>{Symbol =&gt; String/Integer}</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns a hash representing the version of Sass. The `:major`, `:minor`,
and `:teeny` keys have their respective numbers as Integers. The `:name`
key has the name of the version. The `:string` key contains a
human-readable string representation of the version. The `:number` key is
the major, minor, and teeny keys separated by periods. The `:date` key,
which is not guaranteed to be defined, is the `DateTime`</p>
<pre class="code ruby"><code class="ruby">at which this release was cut.
</code></pre>
<p>If Sass is checked out from Git, the `:rev` key will have the revision
hash. For example:</p>
<pre class="code ruby"><code class="ruby"><span class='lbrace'>{</span>
<span class='symbol'>:string</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>2.1.0.9616393</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
<span class='symbol'>:rev</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>9616393b8924ef36639c7e82aa88a51a24d16949</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
<span class='symbol'>:number</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>2.1.0</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
<span class='symbol'>:date</span> <span class='op'>=&gt;</span> <span class='const'>DateTime</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Apr 30 13:52:01 2009 -0700</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='comma'>,</span>
<span class='symbol'>:major</span> <span class='op'>=&gt;</span> <span class='int'>2</span><span class='comma'>,</span> <span class='symbol'>:minor</span> <span class='op'>=&gt;</span> <span class='int'>1</span><span class='comma'>,</span> <span class='symbol'>:teeny</span> <span class='op'>=&gt;</span> <span class='int'>0</span>
<span class='rbrace'>}</span>
</code></pre>
<p>If a prerelease version of Sass is being used, the `:string` and `:number`
fields will reflect the full version (e.g. `“2.2.beta.1”`), and the
`:teeny` field will be `-1`. A `:prerelease` key will contain the name of
the prerelease (e.g. `“beta”`), and a `:prerelease_number` key will contain
the rerelease number. For example:</p>
<pre class="code ruby"><code class="ruby"><span class='lbrace'>{</span>
<span class='symbol'>:string</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>3.0.beta.1</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
<span class='symbol'>:number</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>3.0.beta.1</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
<span class='symbol'>:date</span> <span class='op'>=&gt;</span> <span class='const'>DateTime</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Mar 31 00:38:04 2010 -0700</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='comma'>,</span>
<span class='symbol'>:major</span> <span class='op'>=&gt;</span> <span class='int'>3</span><span class='comma'>,</span> <span class='symbol'>:minor</span> <span class='op'>=&gt;</span> <span class='int'>0</span><span class='comma'>,</span> <span class='symbol'>:teeny</span> <span class='op'>=&gt;</span> <span class='op'>-</span><span class='int'>1</span><span class='comma'>,</span>
<span class='symbol'>:prerelease</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>beta</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
<span class='symbol'>:prerelease_number</span> <span class='op'>=&gt;</span> <span class='int'>1</span>
<span class='rbrace'>}</span>
</code></pre>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>{Symbol =&gt; String/Integer}</tt>)</span>
&mdash;
<div class='inline'>
<p>The version hash</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/version.rb', line 46</span>
<span class='kw'>def</span> <span class='id identifier rubyid_version'>version</span>
<span class='kw'>return</span> <span class='cvar'>@@version</span> <span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='cvar'>@@version</span><span class='rparen'>)</span>
<span class='id identifier rubyid_numbers'>numbers</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../Sass.html" title="Sass (module)">Sass</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Util.html" title="Sass::Util (module)">Util</a></span></span><span class='period'>.</span><span class='id identifier rubyid_scope'><span class='object_link'><a href="Util.html#scope-instance_method" title="Sass::Util#scope (method)">scope</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>VERSION</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>.</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='period'>.</span>
<span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_n'>n</span><span class='op'>|</span> <span class='id identifier rubyid_n'>n</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^[0-9]+$</span><span class='regexp_end'>/</span></span> <span class='op'>?</span> <span class='id identifier rubyid_n'>n</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='op'>:</span> <span class='id identifier rubyid_n'>n</span><span class='rbrace'>}</span>
<span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../Sass.html" title="Sass (module)">Sass</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Util.html" title="Sass::Util (module)">Util</a></span></span><span class='period'>.</span><span class='id identifier rubyid_scope'><span class='object_link'><a href="Util.html#scope-instance_method" title="Sass::Util#scope (method)">scope</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>VERSION_NAME</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
<span class='cvar'>@@version</span> <span class='op'>=</span> <span class='lbrace'>{</span>
<span class='symbol'>:major</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_numbers'>numbers</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='comma'>,</span>
<span class='symbol'>:minor</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_numbers'>numbers</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='comma'>,</span>
<span class='symbol'>:teeny</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_numbers'>numbers</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span><span class='comma'>,</span>
<span class='symbol'>:name</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_name'>name</span>
<span class='rbrace'>}</span>
<span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_date'>date</span> <span class='op'>=</span> <span class='id identifier rubyid_version_date'>version_date</span><span class='rparen'>)</span>
<span class='cvar'>@@version</span><span class='lbracket'>[</span><span class='symbol'>:date</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_date'>date</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='id identifier rubyid_numbers'>numbers</span><span class='lbracket'>[</span><span class='int'>3</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
<span class='cvar'>@@version</span><span class='lbracket'>[</span><span class='symbol'>:teeny</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='op'>-</span><span class='int'>1</span>
<span class='cvar'>@@version</span><span class='lbracket'>[</span><span class='symbol'>:prerelease</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_numbers'>numbers</span><span class='lbracket'>[</span><span class='int'>3</span><span class='rbracket'>]</span>
<span class='cvar'>@@version</span><span class='lbracket'>[</span><span class='symbol'>:prerelease_number</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_numbers'>numbers</span><span class='lbracket'>[</span><span class='int'>4</span><span class='rbracket'>]</span>
<span class='kw'>end</span>
<span class='cvar'>@@version</span><span class='lbracket'>[</span><span class='symbol'>:number</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_numbers'>numbers</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>.</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
<span class='cvar'>@@version</span><span class='lbracket'>[</span><span class='symbol'>:string</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='cvar'>@@version</span><span class='lbracket'>[</span><span class='symbol'>:number</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span>
<span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_rev'>rev</span> <span class='op'>=</span> <span class='id identifier rubyid_revision_number'>revision_number</span><span class='rparen'>)</span>
<span class='cvar'>@@version</span><span class='lbracket'>[</span><span class='symbol'>:rev</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_rev'>rev</span>
<span class='kw'>unless</span> <span class='id identifier rubyid_rev'>rev</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='CHAR'>?(</span>
<span class='cvar'>@@version</span><span class='lbracket'>[</span><span class='symbol'>:string</span><span class='rbracket'>]</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_rev'>rev</span><span class='lbracket'>[</span><span class='int'>0</span><span class='op'>...</span><span class='int'>7</span><span class='rbracket'>]</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='cvar'>@@version</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Mon Oct 22 13:20:50 2018 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.12 (ruby-2.5.3).
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-535380-14', 'sass-lang.com');
ga('send', 'pageview');
</script>
</body>
</html>