mirror of
https://github.com/danog/sass-site.git
synced 2025-01-09 14:38:39 +01:00
3757 lines
108 KiB
HTML
3757 lines
108 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>
|
|
Class: Sass::Script::Value::Number
|
|
|
|
— 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/Script/Value/Number.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 (N)</a> »
|
|
<span class='title'><span class='object_link'><a href="../../../Sass.html" title="Sass (module)">Sass</a></span></span> » <span class='title'><span class='object_link'><a href="../../Script.html" title="Sass::Script (module)">Script</a></span></span> » <span class='title'><span class='object_link'><a href="../Value.html" title="Sass::Script::Value (module)">Value</a></span></span>
|
|
»
|
|
<span class="title">Number</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>Class: Sass::Script::Value::Number
|
|
|
|
|
|
|
|
</h1>
|
|
|
|
<dl class="box">
|
|
|
|
<dt class="r1">Inherits:</dt>
|
|
<dd class="r1">
|
|
<span class="inheritName"><span class='object_link'><a href="Base.html" title="Sass::Script::Value::Base (class)">Base</a></span></span>
|
|
|
|
<ul class="fullTree">
|
|
<li>Object</li>
|
|
|
|
<li class="next"><span class='object_link'><a href="Base.html" title="Sass::Script::Value::Base (class)">Base</a></span></li>
|
|
|
|
<li class="next">Sass::Script::Value::Number</li>
|
|
|
|
</ul>
|
|
<a href="#" class="inheritanceTree">show all</a>
|
|
|
|
</dd>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<dt class="r2 last">Defined in:</dt>
|
|
<dd class="r2 last">.ruby-sass/lib/sass/script/value/number.rb</dd>
|
|
|
|
</dl>
|
|
<div class="clear"></div>
|
|
|
|
<h2>Overview</h2><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>A SassScript object representing a number. SassScript numbers can have
|
|
decimal values, and can also have units. For example, `12`, `1px`, and
|
|
`10.45em` are all valid values.</p>
|
|
|
|
<p>Numbers can also have more complex units, such as `1px*em/in`. These cannot
|
|
be inputted directly in Sass code at the moment.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
|
|
</div>
|
|
<h2>Constant Summary</h2>
|
|
|
|
<dl class="constants">
|
|
|
|
<dt id="NO_UNITS-constant" class="">NO_UNITS =
|
|
<div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Used so we don't allocate two new arrays for each new number.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
|
|
</div>
|
|
</dt>
|
|
<dd><pre class="code"><span class='lbracket'>[</span><span class='rbracket'>]</span></pre></dd>
|
|
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
|
<ul class="summary">
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#denominator_units-instance_method" title="#denominator_units (instance method)">#<strong>denominator_units</strong> ⇒ Array<String> </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
<span class="note title readonly">readonly</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>A list of units in the denominator of the number.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#numerator_units-instance_method" title="#numerator_units (instance method)">#<strong>numerator_units</strong> ⇒ Array<String> </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
<span class="note title readonly">readonly</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>A list of units in the numerator of the number.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#original-instance_method" title="#original (instance method)">#<strong>original</strong> ⇒ Boolean<sup>?</sup> </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>The original representation of this number.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#value-instance_method" title="#value (instance method)">#<strong>value</strong> ⇒ Numeric </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
<span class="note title readonly">readonly</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>The Ruby value of the number.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="Base.html" title="Sass::Script::Value::Base (class)">Base</a></span></h3>
|
|
<p class="inherited"><span class='object_link'><a href="Base.html#options-instance_method" title="Sass::Script::Value::Base#options (method)">#options</a></span>, <span class='object_link'><a href="Base.html#source_range-instance_method" title="Sass::Script::Value::Base#source_range (method)">#source_range</a></span></p>
|
|
|
|
|
|
|
|
<h2>
|
|
Class Method Summary
|
|
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
|
</h2>
|
|
|
|
<ul class="summary">
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#epsilon-class_method" title="epsilon (class method)">.<strong>epsilon</strong> ⇒ Object </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Used in checking equality of floating point numbers.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#precision-class_method" title="precision (class method)">.<strong>precision</strong> ⇒ Object </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'></div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#precision=-class_method" title="precision= (class method)">.<strong>precision=</strong>(digits) ⇒ Object </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Sets the number of digits of precision For example, if this is `3`,
|
|
`3.1415926` will be printed as `3.142`.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#precision_factor-class_method" title="precision_factor (class method)">.<strong>precision_factor</strong> ⇒ Object </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>the precision factor used in numeric output it is derived from the
|
|
`precision` method.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<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="#coerce-instance_method" title="#coerce (instance method)">#<strong>coerce</strong>(num_units, den_units) ⇒ Number </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Returns this number converted to other units.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#comparable_to%3F-instance_method" title="#comparable_to? (instance method)">#<strong>comparable_to?</strong>(other) ⇒ Boolean </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Whether or not this number can be compared with the other.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#div-instance_method" title="#div (instance method)">#<strong>div</strong>(other) ⇒ Value </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>The SassScript `/` operation.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#eq-instance_method" title="#eq (instance method)">#<strong>eq</strong>(other) ⇒ Boolean </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>The SassScript `==` operation.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#eql%3F-instance_method" title="#eql? (instance method)">#<strong>eql?</strong>(other) ⇒ Boolean </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Hash-equality works differently than `==` equality for numbers.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#gt-instance_method" title="#gt (instance method)">#<strong>gt</strong>(other) ⇒ Boolean </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>The SassScript `>` operation.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#gte-instance_method" title="#gte (instance method)">#<strong>gte</strong>(other) ⇒ Boolean </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>The SassScript `>=` operation.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#hash-instance_method" title="#hash (instance method)">#<strong>hash</strong> ⇒ Object </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'></div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(value, numerator_units = NO_UNITS, denominator_units = NO_UNITS) ⇒ Number </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span class="note title constructor">constructor</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>A new instance of Number.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#inspect-instance_method" title="#inspect (instance method)">#<strong>inspect</strong>(opts = {}) ⇒ String </a>
|
|
|
|
|
|
|
|
(also: #to_sass)
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Returns a readable representation of this number.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#int%3F-instance_method" title="#int? (instance method)">#<strong>int?</strong> ⇒ Boolean </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Whether or not this number is an integer.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#is_unit%3F-instance_method" title="#is_unit? (instance method)">#<strong>is_unit?</strong>(unit) ⇒ Boolean </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Checks whether the number has the numerator unit specified.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#legal_units%3F-instance_method" title="#legal_units? (instance method)">#<strong>legal_units?</strong> ⇒ Boolean </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Whether or not this number has units that can be represented in CSS (that
|
|
is, zero or one <span class='object_link'><a href="#numerator_units-instance_method" title="Sass::Script::Value::Number#numerator_units (method)">#numerator_units</a></span>).</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#lt-instance_method" title="#lt (instance method)">#<strong>lt</strong>(other) ⇒ Boolean </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>The SassScript `<` operation.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#lte-instance_method" title="#lte (instance method)">#<strong>lte</strong>(other) ⇒ Boolean </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>The SassScript `<=` operation.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#minus-instance_method" title="#minus (instance method)">#<strong>minus</strong>(other) ⇒ Value </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>The SassScript binary `-` operation (e.g. `$a - $b`).</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#mod-instance_method" title="#mod (instance method)">#<strong>mod</strong>(other) ⇒ Number </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>The SassScript `%` operation.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#plus-instance_method" title="#plus (instance method)">#<strong>plus</strong>(other) ⇒ Value </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>The SassScript `+` operation.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#times-instance_method" title="#times (instance method)">#<strong>times</strong>(other) ⇒ Number, Color </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>The SassScript `*` operation.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#to_i-instance_method" title="#to_i (instance method)">#<strong>to_i</strong> ⇒ Integer </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>The integer value of the number.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#to_s-instance_method" title="#to_s (instance method)">#<strong>to_s</strong>(opts = {}) ⇒ String </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>The CSS representation of this number.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#unary_minus-instance_method" title="#unary_minus (instance method)">#<strong>unary_minus</strong> ⇒ Number </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>The SassScript unary `-` operation (e.g. `-$a`).</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#unary_plus-instance_method" title="#unary_plus (instance method)">#<strong>unary_plus</strong> ⇒ Number </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>The SassScript unary `+` operation (e.g. `+$a`).</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#unit_str-instance_method" title="#unit_str (instance method)">#<strong>unit_str</strong> ⇒ String </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Returns a human readable representation of the units in this number.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#unitless%3F-instance_method" title="#unitless? (instance method)">#<strong>unitless?</strong> ⇒ Boolean </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Whether or not this number has no units.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Base.html" title="Sass::Script::Value::Base (class)">Base</a></span></h3>
|
|
<p class="inherited"><span class='object_link'><a href="Base.html#==-instance_method" title="Sass::Script::Value::Base#== (method)">#==</a></span>, <span class='object_link'><a href="Base.html#assert_int!-instance_method" title="Sass::Script::Value::Base#assert_int! (method)">#assert_int!</a></span>, <span class='object_link'><a href="Base.html#bracketed-instance_method" title="Sass::Script::Value::Base#bracketed (method)">#bracketed</a></span>, <span class='object_link'><a href="Base.html#neq-instance_method" title="Sass::Script::Value::Base#neq (method)">#neq</a></span>, <span class='object_link'><a href="Base.html#null%3F-instance_method" title="Sass::Script::Value::Base#null? (method)">#null?</a></span>, <span class='object_link'><a href="Base.html#separator-instance_method" title="Sass::Script::Value::Base#separator (method)">#separator</a></span>, <span class='object_link'><a href="Base.html#single_eq-instance_method" title="Sass::Script::Value::Base#single_eq (method)">#single_eq</a></span>, <span class='object_link'><a href="Base.html#to_a-instance_method" title="Sass::Script::Value::Base#to_a (method)">#to_a</a></span>, <span class='object_link'><a href="Base.html#to_bool-instance_method" title="Sass::Script::Value::Base#to_bool (method)">#to_bool</a></span>, <span class='object_link'><a href="Base.html#to_h-instance_method" title="Sass::Script::Value::Base#to_h (method)">#to_h</a></span>, <span class='object_link'><a href="Base.html#unary_div-instance_method" title="Sass::Script::Value::Base#unary_div (method)">#unary_div</a></span>, <span class='object_link'><a href="Base.html#unary_not-instance_method" title="Sass::Script::Value::Base#unary_not (method)">#unary_not</a></span>, <span class='object_link'><a href="Base.html#with_contents-instance_method" title="Sass::Script::Value::Base#with_contents (method)">#with_contents</a></span></p>
|
|
<div id="constructor_details" class="method_details_list">
|
|
<h2>Constructor Details</h2>
|
|
|
|
<div class="method_details first">
|
|
<h3 class="signature first" id="initialize-instance_method">
|
|
|
|
#<strong>initialize</strong>(value, numerator_units = NO_UNITS, denominator_units = NO_UNITS) ⇒ <tt><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Returns a new instance of Number</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>value</span>
|
|
|
|
|
|
<span class='type'>(<tt>Numeric</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The value of the number</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>numerator_units</span>
|
|
|
|
|
|
<span class='type'>(<tt>::String</tt>, <tt>Array<::String></tt>)</span>
|
|
|
|
|
|
<em class="default">(defaults to: <tt>NO_UNITS</tt>)</em>
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>See <span class='object_link'><a href="#numerator_units-instance_method" title="Sass::Script::Value::Number#numerator_units (method)">#numerator_units</a></span></p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>denominator_units</span>
|
|
|
|
|
|
<span class='type'>(<tt>::String</tt>, <tt>Array<::String></tt>)</span>
|
|
|
|
|
|
<em class="default">(defaults to: <tt>NO_UNITS</tt>)</em>
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>See <span class='object_link'><a href="#denominator_units-instance_method" title="Sass::Script::Value::Number#denominator_units (method)">#denominator_units</a></span></p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
70
|
|
71
|
|
72
|
|
73
|
|
74
|
|
75
|
|
76
|
|
77
|
|
78</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 70</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_numerator_units'>numerator_units</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="#NO_UNITS-constant" title="Sass::Script::Value::Number::NO_UNITS (constant)">NO_UNITS</a></span></span><span class='comma'>,</span> <span class='id identifier rubyid_denominator_units'>denominator_units</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="#NO_UNITS-constant" title="Sass::Script::Value::Number::NO_UNITS (constant)">NO_UNITS</a></span></span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_numerator_units'>numerator_units</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_numerator_units'>numerator_units</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_numerator_units'>numerator_units</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_denominator_units'>denominator_units</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_denominator_units'>denominator_units</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_denominator_units'>denominator_units</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span>
|
|
<span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
|
<span class='ivar'>@numerator_units</span> <span class='op'>=</span> <span class='id identifier rubyid_numerator_units'>numerator_units</span>
|
|
<span class='ivar'>@denominator_units</span> <span class='op'>=</span> <span class='id identifier rubyid_denominator_units'>denominator_units</span>
|
|
<span class='ivar'>@options</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
|
<span class='id identifier rubyid_normalize!'>normalize!</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="constructor_details" class="method_details_list">
|
|
<h2>Constructor Details</h2>
|
|
|
|
<div class="method_details first">
|
|
<h3 class="signature first" id="initialize-instance_method">
|
|
|
|
#<strong>initialize</strong>(value, numerator_units = NO_UNITS, denominator_units = NO_UNITS) ⇒ <tt><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Returns a new instance of Number</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>value</span>
|
|
|
|
|
|
<span class='type'>(<tt>Numeric</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The value of the number</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>numerator_units</span>
|
|
|
|
|
|
<span class='type'>(<tt>::String</tt>, <tt>Array<::String></tt>)</span>
|
|
|
|
|
|
<em class="default">(defaults to: <tt>NO_UNITS</tt>)</em>
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>See <span class='object_link'><a href="#numerator_units-instance_method" title="Sass::Script::Value::Number#numerator_units (method)">#numerator_units</a></span></p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>denominator_units</span>
|
|
|
|
|
|
<span class='type'>(<tt>::String</tt>, <tt>Array<::String></tt>)</span>
|
|
|
|
|
|
<em class="default">(defaults to: <tt>NO_UNITS</tt>)</em>
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>See <span class='object_link'><a href="#denominator_units-instance_method" title="Sass::Script::Value::Number#denominator_units (method)">#denominator_units</a></span></p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
70
|
|
71
|
|
72
|
|
73
|
|
74
|
|
75
|
|
76
|
|
77
|
|
78</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 70</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_numerator_units'>numerator_units</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="#NO_UNITS-constant" title="Sass::Script::Value::Number::NO_UNITS (constant)">NO_UNITS</a></span></span><span class='comma'>,</span> <span class='id identifier rubyid_denominator_units'>denominator_units</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="#NO_UNITS-constant" title="Sass::Script::Value::Number::NO_UNITS (constant)">NO_UNITS</a></span></span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_numerator_units'>numerator_units</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_numerator_units'>numerator_units</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_numerator_units'>numerator_units</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_denominator_units'>denominator_units</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_denominator_units'>denominator_units</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_denominator_units'>denominator_units</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span>
|
|
<span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
|
<span class='ivar'>@numerator_units</span> <span class='op'>=</span> <span class='id identifier rubyid_numerator_units'>numerator_units</span>
|
|
<span class='ivar'>@denominator_units</span> <span class='op'>=</span> <span class='id identifier rubyid_denominator_units'>denominator_units</span>
|
|
<span class='ivar'>@options</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
|
<span class='id identifier rubyid_normalize!'>normalize!</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="instance_attr_details" class="attr_details">
|
|
<h2>Instance Attribute Details</h2>
|
|
|
|
|
|
<span id=""></span>
|
|
<div class="method_details first">
|
|
<h3 class="signature first" id="denominator_units-instance_method">
|
|
|
|
#<strong>denominator_units</strong> ⇒ <tt>Array<<span class='object_link'><a href="String.html" title="Sass::Script::Value::String (class)">String</a></span>></tt> <span class="extras">(readonly)</span>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>A list of units in the denominator of the number. For example,
|
|
`1px*em/in*cm` would return `[“in”, “cm”]`</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>Array<<span class='object_link'><a href="String.html" title="Sass::Script::Value::String (class)">String</a></span>></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
24
|
|
25
|
|
26</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 24</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_denominator_units'>denominator_units</span>
|
|
<span class='ivar'>@denominator_units</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
|
|
<span id=""></span>
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="numerator_units-instance_method">
|
|
|
|
#<strong>numerator_units</strong> ⇒ <tt>Array<<span class='object_link'><a href="String.html" title="Sass::Script::Value::String (class)">String</a></span>></tt> <span class="extras">(readonly)</span>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>A list of units in the numerator of the number. For example, `1px*em/in*cm`
|
|
would return `[“px”, “em”]`</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>Array<<span class='object_link'><a href="String.html" title="Sass::Script::Value::String (class)">String</a></span>></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
19
|
|
20
|
|
21</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 19</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_numerator_units'>numerator_units</span>
|
|
<span class='ivar'>@numerator_units</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
|
|
<span id="original=-instance_method"></span>
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="original-instance_method">
|
|
|
|
#<strong>original</strong> ⇒ <tt>Boolean</tt><sup>?</sup>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>The original representation of this number. For example, although the
|
|
result of `1px/2px` is `0.5`, the value of `#original` is `“1px/2px”`.</p>
|
|
|
|
<p>This is only non-nil when the original value should be used as the CSS
|
|
value, as in `font: 1px/2px`.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>Boolean</tt>, <tt>nil</tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
34
|
|
35
|
|
36</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 34</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_original'>original</span>
|
|
<span class='ivar'>@original</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
|
|
<span id=""></span>
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="value-instance_method">
|
|
|
|
#<strong>value</strong> ⇒ <tt>Numeric</tt> <span class="extras">(readonly)</span>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>The Ruby value of the number.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>Numeric</tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
14
|
|
15
|
|
16</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 14</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_value'>value</span>
|
|
<span class='ivar'>@value</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
<div id="class_method_details" class="method_details_list">
|
|
<h2>Class Method Details</h2>
|
|
|
|
|
|
<div class="method_details first">
|
|
<h3 class="signature first" id="epsilon-class_method">
|
|
|
|
.<strong>epsilon</strong> ⇒ <tt>Object</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Used in checking equality of floating point numbers. Any numbers within an
|
|
`epsilon` of each other are considered functionally equal. The value for
|
|
epsilon is one tenth of the current numeric precision.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
60
|
|
61
|
|
62</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 60</span>
|
|
|
|
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_epsilon'>epsilon</span>
|
|
<span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_current'>current</span><span class='lbracket'>[</span><span class='symbol'>:sass_numeric_epsilon</span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='int'>1</span> <span class='op'>/</span> <span class='lparen'>(</span><span class='id identifier rubyid_precision_factor'>precision_factor</span> <span class='op'>*</span> <span class='int'>10</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="precision-class_method">
|
|
|
|
.<strong>precision</strong> ⇒ <tt>Object</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
36
|
|
37
|
|
38</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 36</span>
|
|
|
|
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_precision'>precision</span>
|
|
<span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_current'>current</span><span class='lbracket'>[</span><span class='symbol'>:sass_numeric_precision</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_main'>main</span><span class='lbracket'>[</span><span class='symbol'>:sass_numeric_precision</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='int'>10</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="precision=-class_method">
|
|
|
|
.<strong>precision=</strong>(digits) ⇒ <tt>Object</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Sets the number of digits of precision For example, if this is `3`,
|
|
`3.1415926` will be printed as `3.142`. The numeric precision is stored as
|
|
a thread local for thread safety reasons. To set for all threads, be sure
|
|
to set the precision on the main thread.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
45
|
|
46
|
|
47
|
|
48
|
|
49</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 45</span>
|
|
|
|
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_precision='>precision=</span><span class='lparen'>(</span><span class='id identifier rubyid_digits'>digits</span><span class='rparen'>)</span>
|
|
<span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_current'>current</span><span class='lbracket'>[</span><span class='symbol'>:sass_numeric_precision</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_digits'>digits</span><span class='period'>.</span><span class='id identifier rubyid_round'>round</span>
|
|
<span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_current'>current</span><span class='lbracket'>[</span><span class='symbol'>:sass_numeric_precision_factor</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
|
<span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_current'>current</span><span class='lbracket'>[</span><span class='symbol'>:sass_numeric_epsilon</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="precision_factor-class_method">
|
|
|
|
.<strong>precision_factor</strong> ⇒ <tt>Object</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>the precision factor used in numeric output it is derived from the
|
|
`precision` method.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
53
|
|
54
|
|
55</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 53</span>
|
|
|
|
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_precision_factor'>precision_factor</span>
|
|
<span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_current'>current</span><span class='lbracket'>[</span><span class='symbol'>:sass_numeric_precision_factor</span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='float'>10.0</span><span class='op'>**</span><span class='id identifier rubyid_precision'>precision</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="instance_method_details" class="method_details_list">
|
|
<h2>Instance Method Details</h2>
|
|
|
|
|
|
<div class="method_details first">
|
|
<h3 class="signature first" id="coerce-instance_method">
|
|
|
|
#<strong>coerce</strong>(num_units, den_units) ⇒ <tt><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Returns this number converted to other units. The conversion takes into
|
|
account the relationship between e.g. mm and cm, as well as between e.g. in
|
|
and cm.</p>
|
|
|
|
<p>If this number has no units, it will simply return itself with the given
|
|
units.</p>
|
|
|
|
<p>An incompatible coercion, e.g. between px and cm, will raise an error.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>num_units</span>
|
|
|
|
|
|
<span class='type'>(<tt>Array<<span class='object_link'><a href="String.html" title="Sass::Script::Value::String (class)">String</a></span>></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The numerator units to coerce this number into. See <span class='object_link'><a href="#numerator_units-instance_method" title="Sass::Script::Value::Number#numerator_units (method)">#numerator_units</a></span></p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>den_units</span>
|
|
|
|
|
|
<span class='type'>(<tt>Array<<span class='object_link'><a href="String.html" title="Sass::Script::Value::String (class)">String</a></span>></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The denominator units to coerce this number into. See <span class='object_link'><a href="#denominator_units-instance_method" title="Sass::Script::Value::Number#denominator_units (method)">#denominator_units</a></span></p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The number with the new units</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Raises:</p>
|
|
<ul class="raise">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="../../UnitConversionError.html" title="Sass::UnitConversionError (class)">Sass::UnitConversionError</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>if the given units are incompatible with the number's current units</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
367
|
|
368
|
|
369
|
|
370
|
|
371
|
|
372
|
|
373
|
|
374</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 367</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_coerce'>coerce</span><span class='lparen'>(</span><span class='id identifier rubyid_num_units'>num_units</span><span class='comma'>,</span> <span class='id identifier rubyid_den_units'>den_units</span><span class='rparen'>)</span>
|
|
<span class='const'><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="#initialize-instance_method" title="Sass::Script::Value::Number#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='kw'>if</span> <span class='id identifier rubyid_unitless?'>unitless?</span>
|
|
<span class='id identifier rubyid_value'>value</span>
|
|
<span class='kw'>else</span>
|
|
<span class='id identifier rubyid_value'>value</span> <span class='op'>*</span> <span class='id identifier rubyid_coercion_factor'>coercion_factor</span><span class='lparen'>(</span><span class='ivar'>@numerator_units</span><span class='comma'>,</span> <span class='id identifier rubyid_num_units'>num_units</span><span class='rparen'>)</span> <span class='op'>/</span>
|
|
<span class='id identifier rubyid_coercion_factor'>coercion_factor</span><span class='lparen'>(</span><span class='ivar'>@denominator_units</span><span class='comma'>,</span> <span class='id identifier rubyid_den_units'>den_units</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span><span class='comma'>,</span> <span class='id identifier rubyid_num_units'>num_units</span><span class='comma'>,</span> <span class='id identifier rubyid_den_units'>den_units</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="comparable_to?-instance_method">
|
|
|
|
#<strong>comparable_to?</strong>(other) ⇒ <tt>Boolean</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Returns Whether or not this number can be compared with the other.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>other</span>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>A number to decide if it can be compared with this number.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>Whether or not this number can be compared with the other.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
378
|
|
379
|
|
380
|
|
381
|
|
382
|
|
383</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 378</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_comparable_to?'>comparable_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_operate'>operate</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='comma'>,</span> <span class='symbol'>:+</span><span class='rparen'>)</span>
|
|
<span class='kw'>true</span>
|
|
<span class='kw'>rescue</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="../../UnitConversionError.html" title="Sass::UnitConversionError (class)">UnitConversionError</a></span></span>
|
|
<span class='kw'>false</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="div-instance_method">
|
|
|
|
#<strong>div</strong>(other) ⇒ <tt><span class='object_link'><a href="../Value.html" title="Sass::Script::Value (module)">Value</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>The SassScript `/` operation. Its functionality depends on the type of its
|
|
argument:</p>
|
|
|
|
<p><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Sass::Script::Value::Number</a></span> : Divides this number by the other, converting units
|
|
appropriately.</p>
|
|
|
|
<p><span class='object_link'><a href="../Value.html" title="Sass::Script::Value (module)">Sass::Script::Value</a></span> : See <span class='object_link'><a href="Base.html#div-instance_method" title="Sass::Script::Value::Base#div (method)">Base#div</a></span>.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>other</span>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="../Value.html" title="Sass::Script::Value (module)">Value</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The right-hand side of the operator</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="../Value.html" title="Sass::Script::Value (module)">Value</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The result of the operation</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
172
|
|
173
|
|
174
|
|
175
|
|
176
|
|
177
|
|
178
|
|
179
|
|
180
|
|
181
|
|
182</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 172</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_div'>div</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></span>
|
|
<span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='id identifier rubyid_operate'>operate</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='comma'>,</span> <span class='symbol'>:/</span><span class='rparen'>)</span>
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_original'>original</span> <span class='op'>&&</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_original'>original</span>
|
|
<span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_original'>original</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_original'>original</span><span class='embexpr_end'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_original'>original</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
|
<span class='kw'>end</span>
|
|
<span class='id identifier rubyid_res'>res</span>
|
|
<span class='kw'>else</span>
|
|
<span class='kw'>super</span>
|
|
<span class='kw'>end</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="eq-instance_method">
|
|
|
|
#<strong>eq</strong>(other) ⇒ <tt>Boolean</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>The SassScript `==` operation.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>other</span>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="../Value.html" title="Sass::Script::Value (module)">Value</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The right-hand side of the operator</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>Whether this number is equal to the other object</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
203
|
|
204
|
|
205
|
|
206
|
|
207
|
|
208
|
|
209
|
|
210
|
|
211
|
|
212
|
|
213
|
|
214
|
|
215
|
|
216</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 203</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_eq'>eq</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
|
|
<span class='kw'>return</span> <span class='const'><span class='object_link'><a href="Bool.html" title="Sass::Script::Value::Bool (class)">Bool</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Bool.html#FALSE-constant" title="Sass::Script::Value::Bool::FALSE (constant)">FALSE</a></span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</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="../../Script.html" title="Sass::Script (module)">Script</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Value.html" title="Sass::Script::Value (module)">Value</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_this'>this</span> <span class='op'>=</span> <span class='kw'>self</span>
|
|
<span class='kw'>begin</span>
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_unitless?'>unitless?</span>
|
|
<span class='id identifier rubyid_this'>this</span> <span class='op'>=</span> <span class='id identifier rubyid_this'>this</span><span class='period'>.</span><span class='id identifier rubyid_coerce'>coerce</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_numerator_units'>numerator_units</span><span class='comma'>,</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_denominator_units'>denominator_units</span><span class='rparen'>)</span>
|
|
<span class='kw'>else</span>
|
|
<span class='id identifier rubyid_other'>other</span> <span class='op'>=</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_coerce'>coerce</span><span class='lparen'>(</span><span class='ivar'>@numerator_units</span><span class='comma'>,</span> <span class='ivar'>@denominator_units</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span>
|
|
<span class='kw'>rescue</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="../../UnitConversionError.html" title="Sass::UnitConversionError (class)">UnitConversionError</a></span></span>
|
|
<span class='kw'>return</span> <span class='const'><span class='object_link'><a href="Bool.html" title="Sass::Script::Value::Bool (class)">Bool</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Bool.html#FALSE-constant" title="Sass::Script::Value::Bool::FALSE (constant)">FALSE</a></span></span>
|
|
<span class='kw'>end</span>
|
|
<span class='const'><span class='object_link'><a href="Bool.html" title="Sass::Script::Value::Bool (class)">Bool</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Bool.html#new-class_method" title="Sass::Script::Value::Bool.new (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_basically_equal?'>basically_equal?</span><span class='lparen'>(</span><span class='id identifier rubyid_this'>this</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="eql?-instance_method">
|
|
|
|
#<strong>eql?</strong>(other) ⇒ <tt>Boolean</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Hash-equality works differently than `==` equality for numbers.
|
|
Hash-equality must be transitive, so it just compares the exact value,
|
|
numerator units, and denominator units.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
225
|
|
226
|
|
227
|
|
228</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 225</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_eql?'>eql?</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_basically_equal?'>basically_equal?</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_numerator_units'>numerator_units</span> <span class='op'>==</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_numerator_units'>numerator_units</span> <span class='op'>&&</span>
|
|
<span class='id identifier rubyid_denominator_units'>denominator_units</span> <span class='op'>==</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_denominator_units'>denominator_units</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="gt-instance_method">
|
|
|
|
#<strong>gt</strong>(other) ⇒ <tt>Boolean</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>The SassScript `>` operation.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>other</span>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The right-hand side of the operator</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>Whether this number is greater than the other</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Raises:</p>
|
|
<ul class="raise">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>NoMethodError</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>if `other` is an invalid type</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
235
|
|
236
|
|
237
|
|
238</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 235</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_gt'>gt</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>NoMethodError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:gt</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_operate'>operate</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='comma'>,</span> <span class='symbol'>:></span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="gte-instance_method">
|
|
|
|
#<strong>gte</strong>(other) ⇒ <tt>Boolean</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>The SassScript `>=` operation.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>other</span>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The right-hand side of the operator</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>Whether this number is greater than or equal to the other</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Raises:</p>
|
|
<ul class="raise">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>NoMethodError</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>if `other` is an invalid type</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
245
|
|
246
|
|
247
|
|
248</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 245</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_gte'>gte</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>NoMethodError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:gte</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_operate'>operate</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='comma'>,</span> <span class='symbol'>:>=</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="hash-instance_method">
|
|
|
|
#<strong>hash</strong> ⇒ <tt>Object</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
218
|
|
219
|
|
220</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 218</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_hash'>hash</span>
|
|
<span class='lbracket'>[</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_numerator_units'>numerator_units</span><span class='comma'>,</span> <span class='id identifier rubyid_denominator_units'>denominator_units</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_hash'>hash</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="inspect-instance_method">
|
|
|
|
#<strong>inspect</strong>(opts = {}) ⇒ <tt><span class='object_link'><a href="String.html" title="Sass::Script::Value::String (class)">String</a></span></tt>
|
|
|
|
|
|
|
|
<span class="aliases">Also known as:
|
|
<span class="names"><span id='to_sass-instance_method'>to_sass</span></span>
|
|
</span>
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Returns a readable representation of this number.</p>
|
|
|
|
<p>This representation is valid CSS (and valid SassScript) as long as there is
|
|
only one unit.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Sass::Script::Value::String (class)">String</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The representation</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
285
|
|
286
|
|
287
|
|
288
|
|
289
|
|
290
|
|
291
|
|
292
|
|
293
|
|
294
|
|
295
|
|
296
|
|
297
|
|
298
|
|
299
|
|
300
|
|
301
|
|
302
|
|
303
|
|
304
|
|
305
|
|
306
|
|
307</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 285</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_inspect'>inspect</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
|
<span class='kw'>return</span> <span class='id identifier rubyid_original'>original</span> <span class='kw'>if</span> <span class='id identifier rubyid_original'>original</span>
|
|
|
|
<span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_round'>round</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_str'>str</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
|
|
|
<span class='comment'># Ruby will occasionally print in scientific notation if the number is
|
|
</span> <span class='comment'># small enough. That's technically valid CSS, but it's not well-supported
|
|
</span> <span class='comment'># and confusing.
|
|
</span> <span class='id identifier rubyid_str'>str</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%0.</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_precision'>precision</span><span class='embexpr_end'>}</span><span class='tstring_content'>f</span><span class='tstring_end'>"</span></span> <span class='op'>%</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>0*$</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_str'>str</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>e</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
|
|
|
<span class='comment'># Sometimes numeric formatting will result in a decimal number with a trailing zero (x.0)
|
|
</span> <span class='kw'>if</span> <span class='id identifier rubyid_str'>str</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>(.*)\.0$</span><span class='regexp_end'>/</span></span>
|
|
<span class='id identifier rubyid_str'>str</span> <span class='op'>=</span> <span class='backref'>$1</span>
|
|
<span class='kw'>end</span>
|
|
|
|
<span class='comment'># We omit a leading zero before the decimal point in compressed mode.
|
|
</span> <span class='kw'>if</span> <span class='ivar'>@options</span> <span class='op'>&&</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:style</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='symbol'>:compressed</span>
|
|
<span class='id identifier rubyid_str'>str</span><span class='period'>.</span><span class='id identifier rubyid_sub!'>sub!</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^(-)?0\.</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>\1.</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span>
|
|
|
|
<span class='id identifier rubyid_unitless?'>unitless?</span> <span class='op'>?</span> <span class='id identifier rubyid_str'>str</span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_str'>str</span><span class='embexpr_end'>}</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_unit_str'>unit_str</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="int?-instance_method">
|
|
|
|
#<strong>int?</strong> ⇒ <tt>Boolean</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Returns Whether or not this number is an integer.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>Whether or not this number is an integer.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
318
|
|
319
|
|
320</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 318</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_int?'>int?</span>
|
|
<span class='id identifier rubyid_basically_equal?'>basically_equal?</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>%</span> <span class='int'>1</span><span class='comma'>,</span> <span class='float'>0.0</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="is_unit?-instance_method">
|
|
|
|
#<strong>is_unit?</strong>(unit) ⇒ <tt>Boolean</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Checks whether the number has the numerator unit specified.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<div class="examples">
|
|
<p class="tag_title">Examples:</p>
|
|
|
|
|
|
<pre class="example code"><code>number = Sass::Script::Value::Number.new(10, "px")
|
|
number.is_unit?("px") => true
|
|
number.is_unit?(nil) => false</code></pre>
|
|
|
|
</div>
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>unit</span>
|
|
|
|
|
|
<span class='type'>(<tt>::String</tt>, <tt>nil</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The unit the number should have or nil if the number should be unitless.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">See Also:</p>
|
|
<ul class="see">
|
|
|
|
<li><span class='object_link'><a href="#unitless%3F-instance_method" title="Sass::Script::Value::Number#unitless? (method)">The unitless? method may be more readable.</a></span></li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
337
|
|
338
|
|
339
|
|
340
|
|
341
|
|
342
|
|
343</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 337</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_is_unit?'>is_unit?</span><span class='lparen'>(</span><span class='id identifier rubyid_unit'>unit</span><span class='rparen'>)</span>
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_unit'>unit</span>
|
|
<span class='id identifier rubyid_denominator_units'>denominator_units</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>==</span> <span class='int'>0</span> <span class='op'>&&</span> <span class='id identifier rubyid_numerator_units'>numerator_units</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>==</span> <span class='int'>1</span> <span class='op'>&&</span> <span class='id identifier rubyid_numerator_units'>numerator_units</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='op'>==</span> <span class='id identifier rubyid_unit'>unit</span>
|
|
<span class='kw'>else</span>
|
|
<span class='id identifier rubyid_unitless?'>unitless?</span>
|
|
<span class='kw'>end</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="legal_units?-instance_method">
|
|
|
|
#<strong>legal_units?</strong> ⇒ <tt>Boolean</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Returns Whether or not this number has units that can be represented in CSS
|
|
(that is, zero or one <span class='object_link'><a href="#numerator_units-instance_method" title="Sass::Script::Value::Number#numerator_units (method)">#numerator_units</a></span>).</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>Whether or not this number has units that can be represented in CSS (that
|
|
is, zero or one <span class='object_link'><a href="#numerator_units-instance_method" title="Sass::Script::Value::Number#numerator_units (method)">#numerator_units</a></span>).</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
347
|
|
348
|
|
349</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 347</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_legal_units?'>legal_units?</span>
|
|
<span class='lparen'>(</span><span class='ivar'>@numerator_units</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='op'>||</span> <span class='ivar'>@numerator_units</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>==</span> <span class='int'>1</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='ivar'>@denominator_units</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="lt-instance_method">
|
|
|
|
#<strong>lt</strong>(other) ⇒ <tt>Boolean</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>The SassScript `<` operation.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>other</span>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The right-hand side of the operator</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>Whether this number is less than the other</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Raises:</p>
|
|
<ul class="raise">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>NoMethodError</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>if `other` is an invalid type</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
255
|
|
256
|
|
257
|
|
258</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 255</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_lt'>lt</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>NoMethodError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:lt</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_operate'>operate</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='comma'>,</span> <span class='symbol'>:<</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="lte-instance_method">
|
|
|
|
#<strong>lte</strong>(other) ⇒ <tt>Boolean</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>The SassScript `<=` operation.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>other</span>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The right-hand side of the operator</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>Whether this number is less than or equal to the other</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Raises:</p>
|
|
<ul class="raise">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>NoMethodError</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>if `other` is an invalid type</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
265
|
|
266
|
|
267
|
|
268</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 265</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_lte'>lte</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>NoMethodError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:lte</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_operate'>operate</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='comma'>,</span> <span class='symbol'>:<=</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="minus-instance_method">
|
|
|
|
#<strong>minus</strong>(other) ⇒ <tt><span class='object_link'><a href="../Value.html" title="Sass::Script::Value (module)">Value</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>The SassScript binary `-` operation (e.g. `$a - $b`). Its functionality
|
|
depends on the type of its argument:</p>
|
|
|
|
<p><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Sass::Script::Value::Number</a></span> : Subtracts this number from the other, converting units if
|
|
possible.</p>
|
|
|
|
<p><span class='object_link'><a href="../Value.html" title="Sass::Script::Value (module)">Sass::Script::Value</a></span> : See <span class='object_link'><a href="Base.html#minus-instance_method" title="Sass::Script::Value::Base#minus (method)">Base#minus</a></span>.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>other</span>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="../Value.html" title="Sass::Script::Value (module)">Value</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The right-hand side of the operator</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="../Value.html" title="Sass::Script::Value (module)">Value</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The result of the operation</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Raises:</p>
|
|
<ul class="raise">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="../../UnitConversionError.html" title="Sass::UnitConversionError (class)">Sass::UnitConversionError</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>if `other` is a number with incompatible units</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
117
|
|
118
|
|
119
|
|
120
|
|
121
|
|
122
|
|
123</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 117</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_minus'>minus</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></span>
|
|
<span class='id identifier rubyid_operate'>operate</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='comma'>,</span> <span class='symbol'>:-</span><span class='rparen'>)</span>
|
|
<span class='kw'>else</span>
|
|
<span class='kw'>super</span>
|
|
<span class='kw'>end</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="mod-instance_method">
|
|
|
|
#<strong>mod</strong>(other) ⇒ <tt><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>The SassScript `%` operation.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>other</span>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The right-hand side of the operator</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>This number modulo the other</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Raises:</p>
|
|
<ul class="raise">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>NoMethodError</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>if `other` is an invalid type</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="../../UnitConversionError.html" title="Sass::UnitConversionError (class)">Sass::UnitConversionError</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>if `other` has incompatible units</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
190
|
|
191
|
|
192
|
|
193
|
|
194
|
|
195
|
|
196
|
|
197</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 190</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_mod'>mod</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></span><span class='rparen'>)</span>
|
|
<span class='kw'>return</span> <span class='const'><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="#initialize-instance_method" title="Sass::Script::Value::Number#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='const'>Float</span><span class='op'>::</span><span class='const'>NAN</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span> <span class='op'>==</span> <span class='int'>0</span>
|
|
<span class='id identifier rubyid_operate'>operate</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='comma'>,</span> <span class='symbol'>:%</span><span class='rparen'>)</span>
|
|
<span class='kw'>else</span>
|
|
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>NoMethodError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:mod</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="plus-instance_method">
|
|
|
|
#<strong>plus</strong>(other) ⇒ <tt><span class='object_link'><a href="../Value.html" title="Sass::Script::Value (module)">Value</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>The SassScript `+` operation. Its functionality depends on the type of its
|
|
argument:</p>
|
|
|
|
<p><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Sass::Script::Value::Number</a></span> : Adds the two numbers together, converting units if possible.</p>
|
|
|
|
<p><span class='object_link'><a href="Color.html" title="Sass::Script::Value::Color (class)">Color</a></span> : Adds this number to each of the RGB color channels.</p>
|
|
|
|
<p><span class='object_link'><a href="../Value.html" title="Sass::Script::Value (module)">Sass::Script::Value</a></span> : See <span class='object_link'><a href="Base.html#plus-instance_method" title="Sass::Script::Value::Base#plus (method)">Base#plus</a></span>.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>other</span>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="../Value.html" title="Sass::Script::Value (module)">Value</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The right-hand side of the operator</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="../Value.html" title="Sass::Script::Value (module)">Value</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The result of the operation</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Raises:</p>
|
|
<ul class="raise">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="../../UnitConversionError.html" title="Sass::UnitConversionError (class)">Sass::UnitConversionError</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>if `other` is a number with incompatible units</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
95
|
|
96
|
|
97
|
|
98
|
|
99
|
|
100
|
|
101
|
|
102
|
|
103</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 95</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_plus'>plus</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></span>
|
|
<span class='id identifier rubyid_operate'>operate</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='comma'>,</span> <span class='symbol'>:+</span><span class='rparen'>)</span>
|
|
<span class='kw'>elsif</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="Color.html" title="Sass::Script::Value::Color (class)">Color</a></span></span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_plus'>plus</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
|
|
<span class='kw'>else</span>
|
|
<span class='kw'>super</span>
|
|
<span class='kw'>end</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="times-instance_method">
|
|
|
|
#<strong>times</strong>(other) ⇒ <tt><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></tt>, <tt><span class='object_link'><a href="Color.html" title="Sass::Script::Value::Color (class)">Color</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>The SassScript `*` operation. Its functionality depends on the type of its
|
|
argument:</p>
|
|
|
|
<p><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Sass::Script::Value::Number</a></span> : Multiplies the two numbers together, converting units
|
|
appropriately.</p>
|
|
|
|
<p><span class='object_link'><a href="Color.html" title="Sass::Script::Value::Color (class)">Color</a></span> : Multiplies each of the RGB color channels by this number.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>other</span>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></tt>, <tt><span class='object_link'><a href="Color.html" title="Sass::Script::Value::Color (class)">Color</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The right-hand side of the operator</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></tt>, <tt><span class='object_link'><a href="Color.html" title="Sass::Script::Value::Color (class)">Color</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The result of the operation</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Raises:</p>
|
|
<ul class="raise">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>NoMethodError</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>if `other` is an invalid type</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
151
|
|
152
|
|
153
|
|
154
|
|
155
|
|
156
|
|
157
|
|
158
|
|
159</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 151</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_times'>times</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></span>
|
|
<span class='id identifier rubyid_operate'>operate</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='comma'>,</span> <span class='symbol'>:*</span><span class='rparen'>)</span>
|
|
<span class='kw'>elsif</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'><span class='object_link'><a href="Color.html" title="Sass::Script::Value::Color (class)">Color</a></span></span>
|
|
<span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_times'>times</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
|
|
<span class='kw'>else</span>
|
|
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>NoMethodError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:times</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="to_i-instance_method">
|
|
|
|
#<strong>to_i</strong> ⇒ <tt>Integer</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Returns The integer value of the number</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>Integer</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The integer value of the number</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Raises:</p>
|
|
<ul class="raise">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="../../SyntaxError.html" title="Sass::SyntaxError (class)">Sass::SyntaxError</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>if the number isn't an integer</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
312
|
|
313
|
|
314
|
|
315</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 312</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_to_i'>to_i</span>
|
|
<span class='kw'>super</span> <span class='kw'>unless</span> <span class='id identifier rubyid_int?'>int?</span>
|
|
<span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="to_s-instance_method">
|
|
|
|
#<strong>to_s</strong>(opts = {}) ⇒ <tt><span class='object_link'><a href="String.html" title="Sass::Script::Value::String (class)">String</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Returns The CSS representation of this number</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Sass::Script::Value::String (class)">String</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The CSS representation of this number</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Raises:</p>
|
|
<ul class="raise">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="../../SyntaxError.html" title="Sass::SyntaxError (class)">Sass::SyntaxError</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>if this number has units that can't be used in CSS (e.g. `px*in`)</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
273
|
|
274
|
|
275
|
|
276
|
|
277</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 273</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
|
<span class='kw'>return</span> <span class='id identifier rubyid_original'>original</span> <span class='kw'>if</span> <span class='id identifier rubyid_original'>original</span>
|
|
<span class='id identifier rubyid_raise'>raise</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="../../SyntaxError.html" title="Sass::SyntaxError (class)">SyntaxError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../../SyntaxError.html#initialize-instance_method" title="Sass::SyntaxError#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'> isn't a valid CSS value.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_legal_units?'>legal_units?</span>
|
|
<span class='id identifier rubyid_inspect'>inspect</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="unary_minus-instance_method">
|
|
|
|
#<strong>unary_minus</strong> ⇒ <tt><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>The SassScript unary `-` operation (e.g. `-$a`).</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The negative value of this number</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
135
|
|
136
|
|
137</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 135</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_unary_minus'>unary_minus</span>
|
|
<span class='const'><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="#initialize-instance_method" title="Sass::Script::Value::Number#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='op'>-</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='ivar'>@numerator_units</span><span class='comma'>,</span> <span class='ivar'>@denominator_units</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="unary_plus-instance_method">
|
|
|
|
#<strong>unary_plus</strong> ⇒ <tt><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>The SassScript unary `+` operation (e.g. `+$a`).</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="" title="Sass::Script::Value::Number (class)">Number</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The value of this number</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
128
|
|
129
|
|
130</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 128</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_unary_plus'>unary_plus</span>
|
|
<span class='kw'>self</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="unit_str-instance_method">
|
|
|
|
#<strong>unit_str</strong> ⇒ <tt><span class='object_link'><a href="String.html" title="Sass::Script::Value::String (class)">String</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Returns a human readable representation of the units in this number. For
|
|
complex units this takes the form of: numerator_unit1 * numerator_unit2 /
|
|
denominator_unit1 * denominator_unit2</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Sass::Script::Value::String (class)">String</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>a string that represents the units in this number</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
389
|
|
390
|
|
391
|
|
392
|
|
393
|
|
394
|
|
395
|
|
396</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 389</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_unit_str'>unit_str</span>
|
|
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='ivar'>@numerator_units</span><span class='period'>.</span><span class='id identifier rubyid_sort'>sort</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>*</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
|
<span class='kw'>if</span> <span class='ivar'>@denominator_units</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span>
|
|
<span class='id identifier rubyid_rv'>rv</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/</span><span class='tstring_end'>"</span></span>
|
|
<span class='id identifier rubyid_rv'>rv</span> <span class='op'><<</span> <span class='ivar'>@denominator_units</span><span class='period'>.</span><span class='id identifier rubyid_sort'>sort</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>*</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span>
|
|
<span class='id identifier rubyid_rv'>rv</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="unitless?-instance_method">
|
|
|
|
#<strong>unitless?</strong> ⇒ <tt>Boolean</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Returns Whether or not this number has no units.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>Whether or not this number has no units.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
323
|
|
324
|
|
325</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/number.rb', line 323</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_unitless?'>unitless?</span>
|
|
<span class='ivar'>@numerator_units</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='op'>&&</span> <span class='ivar'>@denominator_units</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="footer">
|
|
Generated on Mon Oct 22 13:20:55 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> |