mirror of
https://github.com/danog/sass-site.git
synced 2025-01-09 14:38:39 +01:00
2565 lines
75 KiB
HTML
2565 lines
75 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<title>
|
|
Module: Sass::Script::Value::Helpers
|
|
|
|
— 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/Helpers.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 (H)</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">Helpers</span>
|
|
|
|
|
|
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
|
</div>
|
|
|
|
<div id="search">
|
|
|
|
<a class="full_list_link" id="class_list_link"
|
|
href="../../../class_list.html">
|
|
Class List
|
|
</a>
|
|
|
|
<a class="full_list_link" id="method_list_link"
|
|
href="../../../method_list.html">
|
|
Method List
|
|
</a>
|
|
|
|
<a class="full_list_link" id="file_list_link"
|
|
href="../../../file_list.html">
|
|
File List
|
|
</a>
|
|
|
|
</div>
|
|
<div class="clear"></div>
|
|
</div>
|
|
|
|
<iframe id="search_frame"></iframe>
|
|
|
|
<div id="content"><h1>Module: Sass::Script::Value::Helpers
|
|
|
|
|
|
|
|
</h1>
|
|
|
|
<dl class="box">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<dt class="r1">Included in:</dt>
|
|
<dd class="r1"><span class='object_link'><a href="../Functions/EvaluationContext.html" title="Sass::Script::Functions::EvaluationContext (class)">Functions::EvaluationContext</a></span></dd>
|
|
|
|
|
|
|
|
<dt class="r2 last">Defined in:</dt>
|
|
<dd class="r2 last">.ruby-sass/lib/sass/script/value/helpers.rb</dd>
|
|
|
|
</dl>
|
|
<div class="clear"></div>
|
|
|
|
<h2>Overview</h2><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Provides helper functions for creating sass values from within ruby
|
|
methods.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Since:</p>
|
|
<ul class="since">
|
|
|
|
<li>
|
|
|
|
|
|
|
|
|
|
|
|
<div class='inline'>
|
|
<p>`3.3.0`</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
<h2>Constant Summary</h2>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<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="#bool-instance_method" title="#bool (instance method)">#<strong>bool</strong>(value) ⇒ Sass::Script::Value::Bool </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Construct a Sass Boolean.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#calc%3F-instance_method" title="#calc? (instance method)">#<strong>calc?</strong>(literal) ⇒ Boolean </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Returns true when the literal is a string containing a calc().</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#hex_color-instance_method" title="#hex_color (instance method)">#<strong>hex_color</strong>(value, alpha = nil) ⇒ Sass::Script::Value::Color </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Construct a Sass Color from a hex color string.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#hsl_color-instance_method" title="#hsl_color (instance method)">#<strong>hsl_color</strong>(hue, saturation, lightness, alpha = nil) ⇒ Sass::Script::Value::Color </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Construct a Sass Color from hsl values.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#list-instance_method" title="#list (instance method)">#<strong>list</strong>(*elements, separator: nil, bracketed: false) ⇒ Object </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'></div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#map-instance_method" title="#map (instance method)">#<strong>map</strong>(hash) ⇒ Sass::Script::Value::Map </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Construct a Sass map.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#null-instance_method" title="#null (instance method)">#<strong>null</strong> ⇒ Sass::Script::Value::Null </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Create a sass null value.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#number-instance_method" title="#number (instance method)">#<strong>number</strong>(number, unit_string = nil) ⇒ Sass::Script::Value::Number </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Construct a Sass Number from a ruby number.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#parse_complex_selector-instance_method" title="#parse_complex_selector (instance method)">#<strong>parse_complex_selector</strong>(value, name = nil, allow_parent_ref = false) ⇒ Sass::Selector::Sequence </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Parses a user-provided complex selector.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#parse_compound_selector-instance_method" title="#parse_compound_selector (instance method)">#<strong>parse_compound_selector</strong>(value, name = nil, allow_parent_ref = false) ⇒ Sass::Selector::SimpleSequence </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Parses a user-provided compound selector.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#parse_selector-instance_method" title="#parse_selector (instance method)">#<strong>parse_selector</strong>(value, name = nil, allow_parent_ref = false) ⇒ Sass::Selector::CommaSequence </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Parses a user-provided selector.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#quoted_string-instance_method" title="#quoted_string (instance method)">#<strong>quoted_string</strong>(str) ⇒ Sass::Script::Value::String </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Create a quoted string.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#rgb_color-instance_method" title="#rgb_color (instance method)">#<strong>rgb_color</strong>(red, green, blue, alpha = nil) ⇒ Sass::Script::Value::Color </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Construct a Sass Color from rgb values.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#special_number%3F-instance_method" title="#special_number? (instance method)">#<strong>special_number?</strong>(literal) ⇒ Boolean </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Returns whether the literal is a special CSS value that may evaluate to a
|
|
number, such as `calc()` or `var()`.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#unquoted_string-instance_method" title="#unquoted_string (instance method)">#<strong>unquoted_string</strong>(str) ⇒ Sass::Script::Value::String </a>
|
|
|
|
|
|
|
|
(also: #identifier)
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Create an unquoted string.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#var%3F-instance_method" title="#var? (instance method)">#<strong>var?</strong>(literal) ⇒ Boolean </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Returns true when the literal is a string containing a var().</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
<div id="instance_method_details" class="method_details_list">
|
|
<h2>Instance Method Details</h2>
|
|
|
|
|
|
<div class="method_details first">
|
|
<h3 class="signature first" id="bool-instance_method">
|
|
|
|
#<strong>bool</strong>(value) ⇒ <tt><span class='object_link'><a href="Bool.html" title="Sass::Script::Value::Bool (class)">Sass::Script::Value::Bool</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Construct a Sass Boolean.</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>Object</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>A ruby object that will be tested for truthiness.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Bool.html" title="Sass::Script::Value::Bool (class)">Sass::Script::Value::Bool</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>whether the ruby value is truthy.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Since:</p>
|
|
<ul class="since">
|
|
|
|
<li>
|
|
|
|
|
|
|
|
|
|
|
|
<div class='inline'>
|
|
<p>`3.3.0`</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
11
|
|
12
|
|
13</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/helpers.rb', line 11</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_bool'>bool</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</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_value'>value</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="calc?-instance_method">
|
|
|
|
#<strong>calc?</strong>(literal) ⇒ <tt>Boolean</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Returns true when the literal is a string containing a calc().</p>
|
|
|
|
<p>Use <span class='object_link'><a href="#special_number%3F-instance_method" title="Sass::Script::Value::Helpers#special_number? (method)">#special_number?</a></span> in preference to this.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>literal</span>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Base.html" title="Sass::Script::Value::Base (class)">Sass::Script::Value::Base</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The value to check</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>Boolean</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Since:</p>
|
|
<ul class="since">
|
|
|
|
<li>
|
|
|
|
|
|
|
|
|
|
|
|
<div class='inline'>
|
|
<p>`3.3.0`</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
214
|
|
215
|
|
216</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/helpers.rb', line 214</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_calc?'>calc?</span><span class='lparen'>(</span><span class='id identifier rubyid_literal'>literal</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_literal'>literal</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="String.html" title="Sass::Script::Value::String (class)">String</a></span></span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_literal'>literal</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>calc\(</span><span class='regexp_end'>/</span></span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="hex_color-instance_method">
|
|
|
|
#<strong>hex_color</strong>(value, alpha = nil) ⇒ <tt><span class='object_link'><a href="Color.html" title="Sass::Script::Value::Color (class)">Sass::Script::Value::Color</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Construct a Sass Color from a hex color string.</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>::String</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>A string representing a hex color. The leading hash (“#”) is optional.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>alpha</span>
|
|
|
|
|
|
<span class='type'>(<tt>::Number</tt>)</span>
|
|
|
|
|
|
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The alpha channel. A number between 0 and 1.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Color.html" title="Sass::Script::Value::Color (class)">Sass::Script::Value::Color</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>the color object</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Since:</p>
|
|
<ul class="since">
|
|
|
|
<li>
|
|
|
|
|
|
|
|
|
|
|
|
<div class='inline'>
|
|
<p>`3.3.0`</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
21
|
|
22
|
|
23</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/helpers.rb', line 21</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_hex_color'>hex_color</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_alpha'>alpha</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
|
<span class='const'><span class='object_link'><a href="Color.html" title="Sass::Script::Value::Color (class)">Color</a></span></span><span class='period'>.</span><span class='id identifier rubyid_from_hex'><span class='object_link'><a href="Color.html#from_hex-class_method" title="Sass::Script::Value::Color.from_hex (method)">from_hex</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_alpha'>alpha</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="hsl_color-instance_method">
|
|
|
|
#<strong>hsl_color</strong>(hue, saturation, lightness, alpha = nil) ⇒ <tt><span class='object_link'><a href="Color.html" title="Sass::Script::Value::Color (class)">Sass::Script::Value::Color</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Construct a Sass Color from hsl values.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>hue</span>
|
|
|
|
|
|
<span class='type'>(<tt>::Number</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The hue of the color in degrees. A non-negative number, usually less than
|
|
360.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>saturation</span>
|
|
|
|
|
|
<span class='type'>(<tt>::Number</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The saturation of the color. Must be between 0 and 100 inclusive.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>lightness</span>
|
|
|
|
|
|
<span class='type'>(<tt>::Number</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The lightness of the color. Must be between 0 and 100 inclusive.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>alpha</span>
|
|
|
|
|
|
<span class='type'>(<tt>::Number</tt>)</span>
|
|
|
|
|
|
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The alpha channel. A number between 0 and 1.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Color.html" title="Sass::Script::Value::Color (class)">Sass::Script::Value::Color</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>the color object</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Since:</p>
|
|
<ul class="since">
|
|
|
|
<li>
|
|
|
|
|
|
|
|
|
|
|
|
<div class='inline'>
|
|
<p>`3.3.0`</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
36
|
|
37
|
|
38
|
|
39
|
|
40</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/helpers.rb', line 36</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_hsl_color'>hsl_color</span><span class='lparen'>(</span><span class='id identifier rubyid_hue'>hue</span><span class='comma'>,</span> <span class='id identifier rubyid_saturation'>saturation</span><span class='comma'>,</span> <span class='id identifier rubyid_lightness'>lightness</span><span class='comma'>,</span> <span class='id identifier rubyid_alpha'>alpha</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_attrs'>attrs</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='symbol'>:hue</span> <span class='op'>=></span> <span class='id identifier rubyid_hue'>hue</span><span class='comma'>,</span> <span class='symbol'>:saturation</span> <span class='op'>=></span> <span class='id identifier rubyid_saturation'>saturation</span><span class='comma'>,</span> <span class='symbol'>:lightness</span> <span class='op'>=></span> <span class='id identifier rubyid_lightness'>lightness</span><span class='rbrace'>}</span>
|
|
<span class='id identifier rubyid_attrs'>attrs</span><span class='lbracket'>[</span><span class='symbol'>:alpha</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_alpha'>alpha</span> <span class='kw'>if</span> <span class='id identifier rubyid_alpha'>alpha</span>
|
|
<span class='const'><span class='object_link'><a href="Color.html" title="Sass::Script::Value::Color (class)">Color</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Color.html#initialize-instance_method" title="Sass::Script::Value::Color#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_attrs'>attrs</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="list-instance_method">
|
|
|
|
|
|
<span class="overload">#<strong>list</strong>(*elements, separator: , bracketed: false) ⇒ <tt><span class='object_link'><a href="List.html" title="Sass::Script::Value::List (class)">Sass::Script::Value::List</a></span></tt> </span>
|
|
|
|
<span class="overload">#<strong>list</strong>(array, separator: , bracketed: false) ⇒ <tt><span class='object_link'><a href="List.html" title="Sass::Script::Value::List (class)">Sass::Script::Value::List</a></span></tt> </span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Overloads:</p>
|
|
<ul class="overload">
|
|
|
|
|
|
<li class="overload_item">
|
|
<span class="signature">#<strong>list</strong>(*elements, separator: , bracketed: false) ⇒ <tt><span class='object_link'><a href="List.html" title="Sass::Script::Value::List (class)">Sass::Script::Value::List</a></span></tt> </span>
|
|
<div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Create a space-separated list from the arguments given.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>elements</span>
|
|
|
|
|
|
<span class='type'>(<tt>Array<<span class='object_link'><a href="Base.html" title="Sass::Script::Value::Base (class)">Sass::Script::Value::Base</a></span>></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>Each argument will be a list element.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>separator</span>
|
|
|
|
|
|
<span class='type'>(<tt>Symbol</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>Either :space or :comma.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>bracketed</span>
|
|
|
|
|
|
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>Whether the list uses square brackets.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="List.html" title="Sass::Script::Value::List (class)">Sass::Script::Value::List</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The space separated list.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</li>
|
|
|
|
|
|
<li class="overload_item">
|
|
<span class="signature">#<strong>list</strong>(array, separator: , bracketed: false) ⇒ <tt><span class='object_link'><a href="List.html" title="Sass::Script::Value::List (class)">Sass::Script::Value::List</a></span></tt> </span>
|
|
<div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Create a space-separated list from the array given.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>array</span>
|
|
|
|
|
|
<span class='type'>(<tt>Array<<span class='object_link'><a href="Base.html" title="Sass::Script::Value::Base (class)">Sass::Script::Value::Base</a></span>></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>A ruby array of Sass values to make into a list.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>separator</span>
|
|
|
|
|
|
<span class='type'>(<tt>Symbol</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>Either :space or :comma.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>bracketed</span>
|
|
|
|
|
|
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>Whether the list uses square brackets.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="List.html" title="Sass::Script::Value::List (class)">Sass::Script::Value::List</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The space separated list.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Since:</p>
|
|
<ul class="since">
|
|
|
|
<li>
|
|
|
|
|
|
|
|
|
|
|
|
<div class='inline'>
|
|
<p>`3.3.0`</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
85
|
|
86
|
|
87
|
|
88
|
|
89
|
|
90
|
|
91
|
|
92
|
|
93
|
|
94
|
|
95
|
|
96
|
|
97
|
|
98
|
|
99
|
|
100</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/helpers.rb', line 85</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_list'>list</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_elements'>elements</span><span class='comma'>,</span> <span class='label'>separator:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>bracketed:</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
|
<span class='comment'># Support passing separator as the last value in elements for
|
|
</span> <span class='comment'># backwards-compatibility.
|
|
</span> <span class='kw'>if</span> <span class='id identifier rubyid_separator'>separator</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_elements'>elements</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Symbol</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_separator'>separator</span> <span class='op'>=</span> <span class='id identifier rubyid_elements'>elements</span><span class='period'>.</span><span class='id identifier rubyid_pop'>pop</span>
|
|
<span class='kw'>else</span>
|
|
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>A separator of :space or :comma must be specified.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span>
|
|
<span class='kw'>end</span>
|
|
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_elements'>elements</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_elements'>elements</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Array</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_elements'>elements</span> <span class='op'>=</span> <span class='id identifier rubyid_elements'>elements</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
|
<span class='kw'>end</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="List.html" title="Sass::Script::Value::List (class)">List</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="List.html#initialize-instance_method" title="Sass::Script::Value::List#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_elements'>elements</span><span class='comma'>,</span> <span class='label'>separator:</span> <span class='id identifier rubyid_separator'>separator</span><span class='comma'>,</span> <span class='label'>bracketed:</span> <span class='id identifier rubyid_bracketed'>bracketed</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="map-instance_method">
|
|
|
|
#<strong>map</strong>(hash) ⇒ <tt><span class='object_link'><a href="Map.html" title="Sass::Script::Value::Map (class)">Sass::Script::Value::Map</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Construct a Sass map.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>hash</span>
|
|
|
|
|
|
<span class='type'>(<tt>Hash<<span class='object_link'><a href="Base.html" title="Sass::Script::Value::Base (class)">Sass::Script::Value::Base</a></span>,
|
|
<span class='object_link'><a href="Base.html" title="Sass::Script::Value::Base (class)">Sass::Script::Value::Base</a></span>></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>A Ruby map to convert to a Sass map.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Map.html" title="Sass::Script::Value::Map (class)">Sass::Script::Value::Map</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The map.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Since:</p>
|
|
<ul class="since">
|
|
|
|
<li>
|
|
|
|
|
|
|
|
|
|
|
|
<div class='inline'>
|
|
<p>`3.3.0`</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
107
|
|
108
|
|
109</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/helpers.rb', line 107</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
|
|
<span class='const'><span class='object_link'><a href="Map.html" title="Sass::Script::Value::Map (class)">Map</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Map.html#initialize-instance_method" title="Sass::Script::Value::Map#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="null-instance_method">
|
|
|
|
#<strong>null</strong> ⇒ <tt><span class='object_link'><a href="Null.html" title="Sass::Script::Value::Null (class)">Sass::Script::Value::Null</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Create a sass null value.</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="Null.html" title="Sass::Script::Value::Null (class)">Sass::Script::Value::Null</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Since:</p>
|
|
<ul class="since">
|
|
|
|
<li>
|
|
|
|
|
|
|
|
|
|
|
|
<div class='inline'>
|
|
<p>`3.3.0`</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
114
|
|
115
|
|
116</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/helpers.rb', line 114</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_null'>null</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="Null.html" title="Sass::Script::Value::Null (class)">Null</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Null.html#new-class_method" title="Sass::Script::Value::Null.new (method)">new</a></span></span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="number-instance_method">
|
|
|
|
#<strong>number</strong>(number, unit_string = nil) ⇒ <tt><span class='object_link'><a href="Number.html" title="Sass::Script::Value::Number (class)">Sass::Script::Value::Number</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Construct a Sass Number from a ruby number.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>number</span>
|
|
|
|
|
|
<span class='type'>(<tt>::Number</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>A numeric value.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>unit_string</span>
|
|
|
|
|
|
<span class='type'>(<tt>::String</tt>)</span>
|
|
|
|
|
|
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>A unit string of the form `numeral_unit1 * numeral_unit2 … /
|
|
denominator_unit1 * denominator_unit2 …` this is the same format that is
|
|
returned by <span class='object_link'><a href="Number.html#unit_str-instance_method" title="Sass::Script::Value::Number#unit_str (method)">the `unit_str` method</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="Number.html" title="Sass::Script::Value::Number (class)">Sass::Script::Value::Number</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The sass number representing the given ruby number.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">See Also:</p>
|
|
<ul class="see">
|
|
|
|
<li><span class='object_link'><a href="Number.html#unit_str-instance_method" title="Sass::Script::Value::Number#unit_str (method)">Number#unit_str</a></span></li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Since:</p>
|
|
<ul class="since">
|
|
|
|
<li>
|
|
|
|
|
|
|
|
|
|
|
|
<div class='inline'>
|
|
<p>`3.3.0`</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
67
|
|
68
|
|
69</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/helpers.rb', line 67</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_number'>number</span><span class='lparen'>(</span><span class='id identifier rubyid_number'>number</span><span class='comma'>,</span> <span class='id identifier rubyid_unit_string'>unit_string</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
|
<span class='const'><span class='object_link'><a href="Number.html" 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="Number.html#initialize-instance_method" title="Sass::Script::Value::Number#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_number'>number</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_parse_unit_string'>parse_unit_string</span><span class='lparen'>(</span><span class='id identifier rubyid_unit_string'>unit_string</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="parse_complex_selector-instance_method">
|
|
|
|
#<strong>parse_complex_selector</strong>(value, name = nil, allow_parent_ref = false) ⇒ <tt><span class='object_link'><a href="../../Selector/Sequence.html" title="Sass::Selector::Sequence (class)">Sass::Selector::Sequence</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Parses a user-provided complex selector.</p>
|
|
|
|
<p>A complex selector can contain combinators but cannot contain commas.</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><span class='object_link'><a href="String.html" title="Sass::Script::Value::String (class)">Sass::Script::Value::String</a></span></tt>, <tt><span class='object_link'><a href="List.html" title="Sass::Script::Value::List (class)">Sass::Script::Value::List</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The selector to parse. This can be either a string or a list of strings.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>name</span>
|
|
|
|
|
|
<span class='type'>(<tt>Symbol</tt>, <tt>nil</tt>)</span>
|
|
|
|
|
|
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>If provided, the name of the selector argument. This is used for error
|
|
reporting.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>allow_parent_ref</span>
|
|
|
|
|
|
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
|
|
|
|
<em class="default">(defaults to: <tt>false</tt>)</em>
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>Whether the parsed selector should allow parent references.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="../../Selector/Sequence.html" title="Sass::Selector::Sequence (class)">Sass::Selector::Sequence</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The parsed selector.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Raises:</p>
|
|
<ul class="raise">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>ArgumentError</tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Since:</p>
|
|
<ul class="since">
|
|
|
|
<li>
|
|
|
|
|
|
|
|
|
|
|
|
<div class='inline'>
|
|
<p>`3.3.0`</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
172
|
|
173
|
|
174
|
|
175
|
|
176
|
|
177
|
|
178
|
|
179</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/helpers.rb', line 172</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_parse_complex_selector'>parse_complex_selector</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_allow_parent_ref'>allow_parent_ref</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_selector'>selector</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_selector'>parse_selector</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_allow_parent_ref'>allow_parent_ref</span><span class='rparen'>)</span>
|
|
<span class='kw'>return</span> <span class='id identifier rubyid_seq'>seq</span> <span class='kw'>if</span> <span class='id identifier rubyid_selector'>selector</span><span class='period'>.</span><span class='id identifier rubyid_members'>members</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>==</span> <span class='int'>1</span>
|
|
|
|
<span class='id identifier rubyid_err'>err</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'> is not a complex selector</span><span class='tstring_end'>"</span></span>
|
|
<span class='id identifier rubyid_err'>err</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>$</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_tr'>tr</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='comma'>,</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='embexpr_end'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_err'>err</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_name'>name</span>
|
|
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_err'>err</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="parse_compound_selector-instance_method">
|
|
|
|
#<strong>parse_compound_selector</strong>(value, name = nil, allow_parent_ref = false) ⇒ <tt><span class='object_link'><a href="../../Selector/SimpleSequence.html" title="Sass::Selector::SimpleSequence (class)">Sass::Selector::SimpleSequence</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Parses a user-provided compound selector.</p>
|
|
|
|
<p>A compound selector cannot contain combinators or commas.</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><span class='object_link'><a href="String.html" title="Sass::Script::Value::String (class)">Sass::Script::Value::String</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The selector to parse.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>name</span>
|
|
|
|
|
|
<span class='type'>(<tt>Symbol</tt>, <tt>nil</tt>)</span>
|
|
|
|
|
|
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>If provided, the name of the selector argument. This is used for error
|
|
reporting.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>allow_parent_ref</span>
|
|
|
|
|
|
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
|
|
|
|
<em class="default">(defaults to: <tt>false</tt>)</em>
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>Whether the parsed selector should allow parent references.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="../../Selector/SimpleSequence.html" title="Sass::Selector::SimpleSequence (class)">Sass::Selector::SimpleSequence</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The parsed selector.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Raises:</p>
|
|
<ul class="raise">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>ArgumentError</tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Since:</p>
|
|
<ul class="since">
|
|
|
|
<li>
|
|
|
|
|
|
|
|
|
|
|
|
<div class='inline'>
|
|
<p>`3.3.0`</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
193
|
|
194
|
|
195
|
|
196
|
|
197
|
|
198
|
|
199
|
|
200
|
|
201
|
|
202
|
|
203
|
|
204
|
|
205
|
|
206</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/helpers.rb', line 193</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_parse_compound_selector'>parse_compound_selector</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_allow_parent_ref'>allow_parent_ref</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_assert_type'>assert_type</span> <span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='symbol'>:String</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span>
|
|
<span class='id identifier rubyid_selector'>selector</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_selector'>parse_selector</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_allow_parent_ref'>allow_parent_ref</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_seq'>seq</span> <span class='op'>=</span> <span class='id identifier rubyid_selector'>selector</span><span class='period'>.</span><span class='id identifier rubyid_members'>members</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
|
<span class='id identifier rubyid_sseq'>sseq</span> <span class='op'>=</span> <span class='id identifier rubyid_seq'>seq</span><span class='period'>.</span><span class='id identifier rubyid_members'>members</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_selector'>selector</span><span class='period'>.</span><span class='id identifier rubyid_members'>members</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>==</span> <span class='int'>1</span> <span class='op'>&&</span> <span class='id identifier rubyid_seq'>seq</span><span class='period'>.</span><span class='id identifier rubyid_members'>members</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>==</span> <span class='int'>1</span> <span class='op'>&&</span>
|
|
<span class='id identifier rubyid_sseq'>sseq</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="../../Selector.html" title="Sass::Selector (module)">Selector</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../../Selector/SimpleSequence.html" title="Sass::Selector::SimpleSequence (class)">SimpleSequence</a></span></span><span class='rparen'>)</span>
|
|
<span class='kw'>return</span> <span class='id identifier rubyid_sseq'>sseq</span>
|
|
<span class='kw'>end</span>
|
|
|
|
<span class='id identifier rubyid_err'>err</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'> is not a compound selector</span><span class='tstring_end'>"</span></span>
|
|
<span class='id identifier rubyid_err'>err</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>$</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_tr'>tr</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='comma'>,</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='embexpr_end'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_err'>err</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_name'>name</span>
|
|
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_err'>err</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="parse_selector-instance_method">
|
|
|
|
#<strong>parse_selector</strong>(value, name = nil, allow_parent_ref = false) ⇒ <tt><span class='object_link'><a href="../../Selector/CommaSequence.html" title="Sass::Selector::CommaSequence (class)">Sass::Selector::CommaSequence</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Parses a user-provided selector.</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><span class='object_link'><a href="String.html" title="Sass::Script::Value::String (class)">Sass::Script::Value::String</a></span></tt>, <tt><span class='object_link'><a href="List.html" title="Sass::Script::Value::List (class)">Sass::Script::Value::List</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The selector to parse. This can be either a string, a list of strings, or a
|
|
list of lists of strings as returned by `&`.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>name</span>
|
|
|
|
|
|
<span class='type'>(<tt>Symbol</tt>, <tt>nil</tt>)</span>
|
|
|
|
|
|
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>If provided, the name of the selector argument. This is used for error
|
|
reporting.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>allow_parent_ref</span>
|
|
|
|
|
|
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
|
|
|
|
<em class="default">(defaults to: <tt>false</tt>)</em>
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>Whether the parsed selector should allow parent references.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="../../Selector/CommaSequence.html" title="Sass::Selector::CommaSequence (class)">Sass::Selector::CommaSequence</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The parsed selector.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Since:</p>
|
|
<ul class="since">
|
|
|
|
<li>
|
|
|
|
|
|
|
|
|
|
|
|
<div class='inline'>
|
|
<p>`3.3.0`</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
147
|
|
148
|
|
149
|
|
150
|
|
151
|
|
152
|
|
153
|
|
154
|
|
155
|
|
156</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/helpers.rb', line 147</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_parse_selector'>parse_selector</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_allow_parent_ref'>allow_parent_ref</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_str'>str</span> <span class='op'>=</span> <span class='id identifier rubyid_normalize_selector'>normalize_selector</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
|
|
<span class='kw'>begin</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="../../SCSS.html" title="Sass::SCSS (module)">SCSS</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../../SCSS/StaticParser.html" title="Sass::SCSS::StaticParser (class)">StaticParser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../../SCSS/StaticParser.html#initialize-instance_method" title="Sass::SCSS::StaticParser#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='int'>1</span><span class='comma'>,</span> <span class='int'>1</span><span class='comma'>,</span> <span class='id identifier rubyid_allow_parent_ref'>allow_parent_ref</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_parse_selector'><span class='object_link'><a href="../../SCSS/StaticParser.html#parse_selector-instance_method" title="Sass::SCSS::StaticParser#parse_selector (method)">parse_selector</a></span></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="../../SyntaxError.html" title="Sass::SyntaxError (class)">SyntaxError</a></span></span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
|
<span class='id identifier rubyid_err'>err</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'> is not a valid selector: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
|
<span class='id identifier rubyid_err'>err</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>$</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_tr'>tr</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='comma'>,</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='embexpr_end'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_err'>err</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_name'>name</span>
|
|
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_err'>err</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="quoted_string-instance_method">
|
|
|
|
#<strong>quoted_string</strong>(str) ⇒ <tt><span class='object_link'><a href="String.html" title="Sass::Script::Value::String (class)">Sass::Script::Value::String</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Create a quoted string.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>str</span>
|
|
|
|
|
|
<span class='type'>(<tt>::String</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>A ruby string.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<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)">Sass::Script::Value::String</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>A quoted string.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Since:</p>
|
|
<ul class="since">
|
|
|
|
<li>
|
|
|
|
|
|
|
|
|
|
|
|
<div class='inline'>
|
|
<p>`3.3.0`</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
122
|
|
123
|
|
124</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/helpers.rb', line 122</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_quoted_string'>quoted_string</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='rparen'>)</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'>String</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='comma'>,</span> <span class='symbol'>:string</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="rgb_color-instance_method">
|
|
|
|
#<strong>rgb_color</strong>(red, green, blue, alpha = nil) ⇒ <tt><span class='object_link'><a href="Color.html" title="Sass::Script::Value::Color (class)">Sass::Script::Value::Color</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Construct a Sass Color from rgb values.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>red</span>
|
|
|
|
|
|
<span class='type'>(<tt>::Number</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The red component. Must be between 0 and 255 inclusive.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>green</span>
|
|
|
|
|
|
<span class='type'>(<tt>::Number</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The green component. Must be between 0 and 255 inclusive.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>blue</span>
|
|
|
|
|
|
<span class='type'>(<tt>::Number</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The blue component. Must be between 0 and 255 inclusive.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>alpha</span>
|
|
|
|
|
|
<span class='type'>(<tt>::Number</tt>)</span>
|
|
|
|
|
|
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The alpha channel. A number between 0 and 1.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Color.html" title="Sass::Script::Value::Color (class)">Sass::Script::Value::Color</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>the color object</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Since:</p>
|
|
<ul class="since">
|
|
|
|
<li>
|
|
|
|
|
|
|
|
|
|
|
|
<div class='inline'>
|
|
<p>`3.3.0`</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
50
|
|
51
|
|
52
|
|
53
|
|
54</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/helpers.rb', line 50</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_rgb_color'>rgb_color</span><span class='lparen'>(</span><span class='id identifier rubyid_red'>red</span><span class='comma'>,</span> <span class='id identifier rubyid_green'>green</span><span class='comma'>,</span> <span class='id identifier rubyid_blue'>blue</span><span class='comma'>,</span> <span class='id identifier rubyid_alpha'>alpha</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_attrs'>attrs</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='symbol'>:red</span> <span class='op'>=></span> <span class='id identifier rubyid_red'>red</span><span class='comma'>,</span> <span class='symbol'>:green</span> <span class='op'>=></span> <span class='id identifier rubyid_green'>green</span><span class='comma'>,</span> <span class='symbol'>:blue</span> <span class='op'>=></span> <span class='id identifier rubyid_blue'>blue</span><span class='rbrace'>}</span>
|
|
<span class='id identifier rubyid_attrs'>attrs</span><span class='lbracket'>[</span><span class='symbol'>:alpha</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_alpha'>alpha</span> <span class='kw'>if</span> <span class='id identifier rubyid_alpha'>alpha</span>
|
|
<span class='const'><span class='object_link'><a href="Color.html" title="Sass::Script::Value::Color (class)">Color</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Color.html#initialize-instance_method" title="Sass::Script::Value::Color#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_attrs'>attrs</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="special_number?-instance_method">
|
|
|
|
#<strong>special_number?</strong>(literal) ⇒ <tt>Boolean</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Returns whether the literal is a special CSS value that may evaluate to a
|
|
number, such as `calc()` or `var()`.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>literal</span>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Base.html" title="Sass::Script::Value::Base (class)">Sass::Script::Value::Base</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The value to check</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>Boolean</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Since:</p>
|
|
<ul class="since">
|
|
|
|
<li>
|
|
|
|
|
|
|
|
|
|
|
|
<div class='inline'>
|
|
<p>`3.3.0`</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
231
|
|
232
|
|
233</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/helpers.rb', line 231</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_special_number?'>special_number?</span><span class='lparen'>(</span><span class='id identifier rubyid_literal'>literal</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_literal'>literal</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="String.html" title="Sass::Script::Value::String (class)">String</a></span></span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_literal'>literal</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>(calc|var)\(</span><span class='regexp_end'>/</span></span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="unquoted_string-instance_method">
|
|
|
|
#<strong>unquoted_string</strong>(str) ⇒ <tt><span class='object_link'><a href="String.html" title="Sass::Script::Value::String (class)">Sass::Script::Value::String</a></span></tt>
|
|
|
|
|
|
|
|
<span class="aliases">Also known as:
|
|
<span class="names"><span id='identifier-instance_method'>identifier</span></span>
|
|
</span>
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Create an unquoted string.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>str</span>
|
|
|
|
|
|
<span class='type'>(<tt>::String</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>A ruby string.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<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)">Sass::Script::Value::String</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>An unquoted string.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Since:</p>
|
|
<ul class="since">
|
|
|
|
<li>
|
|
|
|
|
|
|
|
|
|
|
|
<div class='inline'>
|
|
<p>`3.3.0`</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
130
|
|
131
|
|
132</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/helpers.rb', line 130</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_unquoted_string'>unquoted_string</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='rparen'>)</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'>String</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='comma'>,</span> <span class='symbol'>:identifier</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="var?-instance_method">
|
|
|
|
#<strong>var?</strong>(literal) ⇒ <tt>Boolean</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Returns true when the literal is a string containing a var().</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>literal</span>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Base.html" title="Sass::Script::Value::Base (class)">Sass::Script::Value::Base</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The value to check</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>Boolean</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Since:</p>
|
|
<ul class="since">
|
|
|
|
<li>
|
|
|
|
|
|
|
|
|
|
|
|
<div class='inline'>
|
|
<p>`3.3.0`</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
222
|
|
223
|
|
224</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/script/value/helpers.rb', line 222</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_var?'>var?</span><span class='lparen'>(</span><span class='id identifier rubyid_literal'>literal</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_literal'>literal</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="String.html" title="Sass::Script::Value::String (class)">String</a></span></span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_literal'>literal</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>var\(</span><span class='regexp_end'>/</span></span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="footer">
|
|
Generated on Mon Oct 22 13:20:50 2018 by
|
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
0.9.12 (ruby-2.5.3).
|
|
</div>
|
|
<script>
|
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
|
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
|
|
|
ga('create', 'UA-535380-14', 'sass-lang.com');
|
|
ga('send', 'pageview');
|
|
</script>
|
|
|
|
</body>
|
|
</html> |