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

7326 lines
245 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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::Util
&mdash; Documentation by YARD 0.9.12
</title>
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="../../assets/css/docs.css" type="text/css" charset="utf-8" />
<script type="text/javascript" charset="utf-8">
hasFrames = window.top.frames.main ? true : false;
relpath = '../';
framesUrl = "../frames.html#!Sass/Util.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 (U)</a> &raquo;
<span class='title'><span class='object_link'><a href="../Sass.html" title="Sass (module)">Sass</a></span></span>
&raquo;
<span class="title">Util</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::Util
</h1>
<dl class="box">
<dt class="r1">Extended by:</dt>
<dd class="r1"><span class='object_link'><a href="" title="Sass::Util (module)">Util</a></span></dd>
<dt class="r2">Included in:</dt>
<dd class="r2"><span class='object_link'><a href="" title="Sass::Util (module)">Util</a></span></dd>
<dt class="r1 last">Defined in:</dt>
<dd class="r1 last">.ruby-sass/lib/sass/util.rb<span class="defines">,<br />
.ruby-sass/lib/sass/util/normalized_map.rb,<br /> .ruby-sass/lib/sass/util/subset_map.rb,<br /> .ruby-sass/lib/sass/util/test.rb</span>
</dd>
</dl>
<div class="clear"></div>
<h2>Overview</h2><div class="docstring">
<div class="discussion">
<p>A module containing various useful functions.</p>
</div>
</div>
<div class="tags">
</div><h2>Defined Under Namespace</h2>
<p class="children">
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Util/Test.html" title="Sass::Util::Test (module)">Test</a></span>
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Util/MultibyteStringScanner.html" title="Sass::Util::MultibyteStringScanner (class)">MultibyteStringScanner</a></span>, <span class='object_link'><a href="Util/NormalizedMap.html" title="Sass::Util::NormalizedMap (class)">NormalizedMap</a></span>, <span class='object_link'><a href="Util/StaticConditionalContext.html" title="Sass::Util::StaticConditionalContext (class)">StaticConditionalContext</a></span>, <span class='object_link'><a href="Util/SubsetMap.html" title="Sass::Util::SubsetMap (class)">SubsetMap</a></span>
</p>
<h2>Constant Summary</h2>
<dl class="constants">
<dt id="RUBY_VERSION_COMPONENTS-constant" class="">RUBY_VERSION_COMPONENTS =
<div class="docstring">
<div class="discussion">
<p>An array of ints representing the Ruby version number.</p>
</div>
</div>
<div class="tags">
</div>
</dt>
<dd><pre class="code"><span class='const'>RUBY_VERSION</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_s'>s</span><span class='op'>|</span> <span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='rbrace'>}</span></pre></dd>
<dt id="RUBY_ENGINE-constant" class="">RUBY_ENGINE =
<div class="docstring">
<div class="discussion">
<p>The Ruby engine we&#39;re running under. Defaults to `“ruby”` if the
top-level constant is undefined.</p>
</div>
</div>
<div class="tags">
</div>
</dt>
<dd><pre class="code"><span class='kw'>defined?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>RUBY_ENGINE</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='op'>::</span><span class='const'>RUBY_ENGINE</span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ruby</span><span class='tstring_end'>&quot;</span></span></pre></dd>
<dt id="CHARSET_REGEXP-constant" class="">CHARSET_REGEXP =
</dt>
<dd><pre class="code"><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\A@charset &quot;([^&quot;]+)&quot;</span><span class='regexp_end'>/</span></span></pre></dd>
<dt id="UTF_8_BOM-constant" class="">UTF_8_BOM =
</dt>
<dd><pre class="code"><span class='id identifier rubyid_bom'>bom</span><span class='period'>.</span><span class='id identifier rubyid_encode'>encode</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>UTF-8</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_force_encoding'>force_encoding</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>BINARY</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span></pre></dd>
<dt id="UTF_16BE_BOM-constant" class="">UTF_16BE_BOM =
</dt>
<dd><pre class="code"><span class='id identifier rubyid_bom'>bom</span><span class='period'>.</span><span class='id identifier rubyid_encode'>encode</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>UTF-16BE</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_force_encoding'>force_encoding</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>BINARY</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span></pre></dd>
<dt id="UTF_16LE_BOM-constant" class="">UTF_16LE_BOM =
</dt>
<dd><pre class="code"><span class='id identifier rubyid_bom'>bom</span><span class='period'>.</span><span class='id identifier rubyid_encode'>encode</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>UTF-16LE</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_force_encoding'>force_encoding</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>BINARY</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span></pre></dd>
<dt id="VLQ_BASE_SHIFT-constant" class="">VLQ_BASE_SHIFT =
</dt>
<dd><pre class="code"><span class='int'>5</span></pre></dd>
<dt id="VLQ_BASE-constant" class="">VLQ_BASE =
</dt>
<dd><pre class="code"><span class='int'>1</span> <span class='op'>&lt;&lt;</span> <span class='const'><span class='object_link'><a href="#VLQ_BASE_SHIFT-constant" title="Sass::Util::VLQ_BASE_SHIFT (constant)">VLQ_BASE_SHIFT</a></span></span></pre></dd>
<dt id="VLQ_BASE_MASK-constant" class="">VLQ_BASE_MASK =
</dt>
<dd><pre class="code"><span class='const'><span class='object_link'><a href="#VLQ_BASE-constant" title="Sass::Util::VLQ_BASE (constant)">VLQ_BASE</a></span></span> <span class='op'>-</span> <span class='int'>1</span></pre></dd>
<dt id="VLQ_CONTINUATION_BIT-constant" class="">VLQ_CONTINUATION_BIT =
</dt>
<dd><pre class="code"><span class='const'><span class='object_link'><a href="#VLQ_BASE-constant" title="Sass::Util::VLQ_BASE (constant)">VLQ_BASE</a></span></span></pre></dd>
<dt id="BASE64_DIGITS-constant" class="">BASE64_DIGITS =
</dt>
<dd><pre class="code"><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>A</span><span class='tstring_end'>&#39;</span></span><span class='op'>..</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Z</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_a'>to_a</span> <span class='op'>+</span> <span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>a</span><span class='tstring_end'>&#39;</span></span><span class='op'>..</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>z</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_a'>to_a</span> <span class='op'>+</span> <span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>0</span><span class='tstring_end'>&#39;</span></span><span class='op'>..</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>9</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_a'>to_a</span> <span class='op'>+</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>+</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>/</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span></pre></dd>
<dt id="BASE64_DIGIT_MAP-constant" class="">BASE64_DIGIT_MAP =
</dt>
<dd><pre class="code"><span class='kw'>begin</span>
<span class='id identifier rubyid_map'>map</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
<span class='const'><span class='object_link'><a href="#BASE64_DIGITS-constant" title="Sass::Util::BASE64_DIGITS (constant)">BASE64_DIGITS</a></span></span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_digit'>digit</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
<span class='id identifier rubyid_map'>map</span><span class='lbracket'>[</span><span class='id identifier rubyid_digit'>digit</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_i'>i</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_map'>map</span>
<span class='kw'>end</span></pre></dd>
<dt id="ATOMIC_WRITE_MUTEX-constant" class="">ATOMIC_WRITE_MUTEX =
</dt>
<dd><pre class="code"><span class='const'>Mutex</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span></pre></dd>
</dl>
<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="#abstract-instance_method" title="#abstract (instance method)">#<strong>abstract</strong>(obj) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Throws a NotImplementedError for an abstract method.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#ap_geq%3F-instance_method" title="#ap_geq? (instance method)">#<strong>ap_geq?</strong>(version) &#x21d2; Boolean </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns whether this environment is using ActionPack of a version greater
than or equal to that specified.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#ap_geq_3%3F-instance_method" title="#ap_geq_3? (instance method)">#<strong>ap_geq_3?</strong> &#x21d2; Boolean </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns whether this environment is using ActionPack version 3.0.0 or
greater.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#array_minus-instance_method" title="#array_minus (instance method)">#<strong>array_minus</strong>(minuend, subtrahend) &#x21d2; Array </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns a sub-array of `minuend` containing only elements that are also in
`subtrahend`.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#atomic_create_and_write_file-instance_method" title="#atomic_create_and_write_file (instance method)">#<strong>atomic_create_and_write_file</strong>(filename, perms = 0666) {|tmpfile| ... } &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>This creates a temp file and yields it for writing.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#av_template_class-instance_method" title="#av_template_class (instance method)">#<strong>av_template_class</strong>(name) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns an ActionView::Template* class.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#caller_info-instance_method" title="#caller_info (instance method)">#<strong>caller_info</strong>(entry = nil) &#x21d2; [String, Integer, (String, nil)] </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns information about the caller of the previous method.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#check_range-instance_method" title="#check_range (instance method)">#<strong>check_range</strong>(name, range, value, unit = &#39;&#39;) &#x21d2; Numeric </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Asserts that `value` falls within `range` (inclusive), leaving room for
slight floating-point errors.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#check_sass_encoding-instance_method" title="#check_sass_encoding (instance method)">#<strong>check_sass_encoding</strong>(str) &#x21d2; (String, Encoding) </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Like #check_encoding, but also checks for a `@charset` declaration at the
beginning of the file and uses that encoding if it exists.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#cleanpath-instance_method" title="#cleanpath (instance method)">#<strong>cleanpath</strong>(path) &#x21d2; Pathname </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Like `Pathname#cleanpath`, but normalizes Windows paths to always use
backslash separators.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#deprecated-instance_method" title="#deprecated (instance method)">#<strong>deprecated</strong>(obj, message = nil) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Prints a deprecation warning for the caller method.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#destructure-instance_method" title="#destructure (instance method)">#<strong>destructure</strong>(val) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Prepare a value for a destructuring assignment (e.g. `a, b = val`).</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#downcase-instance_method" title="#downcase (instance method)">#<strong>downcase</strong>(string) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Like `String.downcase`, but only ever downcases ASCII letters.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#encode_vlq-instance_method" title="#encode_vlq (instance method)">#<strong>encode_vlq</strong>(value) &#x21d2; String </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Encodes `value` as VLQ (<a
href="http://en.wikipedia.org/wiki/VLQ">en.wikipedia.org/wiki/VLQ</a>).</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#extract!-instance_method" title="#extract! (instance method)">#<strong>extract!</strong>(array) {|el| ... } &#x21d2; Array </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Destructively removes all elements from an array that match a block, and
returns the removed elements.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#extract_values-instance_method" title="#extract_values (instance method)">#<strong>extract_values</strong>(arr) &#x21d2; (String, Array) </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Extracts the non-string vlaues from an array containing both strings and
non-strings.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#file_uri_from_path-instance_method" title="#file_uri_from_path (instance method)">#<strong>file_uri_from_path</strong>(path) &#x21d2; String </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Converts `path` to a “file:” URI.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#flatten_vertically-instance_method" title="#flatten_vertically (instance method)">#<strong>flatten_vertically</strong>(arrs) &#x21d2; Array </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Flattens the first level of nested arrays in `arrs`.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#glob-instance_method" title="#glob (instance method)">#<strong>glob</strong>(path) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Like `Dir.glob`, but works with backslash-separated paths on Windows.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#inject_values-instance_method" title="#inject_values (instance method)">#<strong>inject_values</strong>(str, values) &#x21d2; Array </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Undoes <span class='object_link'><a href="#extract_values-instance_method" title="Sass::Util#extract_values (method)">#extract_values</a></span> by transforming a string with escape sequences
into an array of strings and non-string values.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#inspect_obj-instance_method" title="#inspect_obj (instance method)">#<strong>inspect_obj</strong>(obj) &#x21d2; String </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Like `Object#inspect`, but preserves non-ASCII characters rather than
escaping them under Ruby 1.9.2.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#intersperse-instance_method" title="#intersperse (instance method)">#<strong>intersperse</strong>(enum, val) &#x21d2; Array </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Intersperses a value in an enumerable, as would be done with `Array#join`
but without concatenating the array together afterwards.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#ironruby%3F-instance_method" title="#ironruby? (instance method)">#<strong>ironruby?</strong> &#x21d2; Boolean </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Whether or not this is running on IronRuby.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#jruby%3F-instance_method" title="#jruby? (instance method)">#<strong>jruby?</strong> &#x21d2; Boolean </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Whether or not this is running on JRuby.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#jruby_version-instance_method" title="#jruby_version (instance method)">#<strong>jruby_version</strong> &#x21d2; Array&lt;Integer&gt; </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns an array of ints representing the JRuby version number.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#json_escape_string-instance_method" title="#json_escape_string (instance method)">#<strong>json_escape_string</strong>(s) &#x21d2; String </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Escapes certain characters so that the result can be used as the JSON
string value.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#json_value_of-instance_method" title="#json_value_of (instance method)">#<strong>json_value_of</strong>(v) &#x21d2; String </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Converts the argument into a valid JSON value.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#lcs-instance_method" title="#lcs (instance method)">#<strong>lcs</strong>(x, y) {|a, b| ... } &#x21d2; Array </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Computes a single longest common subsequence for `x` and `y`.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#map_hash-instance_method" title="#map_hash (instance method)">#<strong>map_hash</strong>(hash) {|key, value| ... } &#x21d2; Hash </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Maps the key-value pairs of a hash according to a block.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#map_keys-instance_method" title="#map_keys (instance method)">#<strong>map_keys</strong>(hash) {|key| ... } &#x21d2; Hash </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Maps the keys in a hash according to a block.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#map_vals-instance_method" title="#map_vals (instance method)">#<strong>map_vals</strong>(hash) {|value| ... } &#x21d2; Hash </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Maps the values in a hash according to a block.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#max-instance_method" title="#max (instance method)">#<strong>max</strong>(val1, val2) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns the maximum of `val1` and `val2`.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#merge_adjacent_strings-instance_method" title="#merge_adjacent_strings (instance method)">#<strong>merge_adjacent_strings</strong>(arr) &#x21d2; Array </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Concatenates all strings that are adjacent in an array, while leaving other
elements as they are.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#min-instance_method" title="#min (instance method)">#<strong>min</strong>(val1, val2) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns the minimum of `val1` and `val2`.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#pathname-instance_method" title="#pathname (instance method)">#<strong>pathname</strong>(path) &#x21d2; Pathname </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Like `Pathname.new`, but normalizes Windows paths to always use backslash
separators.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#paths-instance_method" title="#paths (instance method)">#<strong>paths</strong>(arrs) &#x21d2; Array&lt;Arrays&gt; </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Return an array of all possible paths through the given arrays.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#powerset-instance_method" title="#powerset (instance method)">#<strong>powerset</strong>(arr) &#x21d2; Set&lt;Set&gt; </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Computes the powerset of the given array.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#rails_env-instance_method" title="#rails_env (instance method)">#<strong>rails_env</strong> &#x21d2; String<sup>?</sup> </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns the environment of the Rails application, if this is running in a
Rails context.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#rails_root-instance_method" title="#rails_root (instance method)">#<strong>rails_root</strong> &#x21d2; String<sup>?</sup> </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns the root of the Rails application, if this is running in a Rails
context.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#rbx%3F-instance_method" title="#rbx? (instance method)">#<strong>rbx?</strong> &#x21d2; Boolean </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Whether or not this is running on Rubinius.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#realpath-instance_method" title="#realpath (instance method)">#<strong>realpath</strong>(path) &#x21d2; Pathname </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns `path` with all symlinks resolved.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#relative_path_from-instance_method" title="#relative_path_from (instance method)">#<strong>relative_path_from</strong>(path, from) &#x21d2; Pathname? </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns `path` relative to `from`.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#replace_subseq-instance_method" title="#replace_subseq (instance method)">#<strong>replace_subseq</strong>(arr, subseq, replacement) &#x21d2; Array </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Non-destructively replaces all occurrences of a subsequence in an array
with another subsequence.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#restrict-instance_method" title="#restrict (instance method)">#<strong>restrict</strong>(value, range) &#x21d2; Numeric </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Restricts a number to falling within a given range.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#retry_on_windows-instance_method" title="#retry_on_windows (instance method)">#<strong>retry_on_windows</strong> { ... } &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Retries a filesystem operation if it fails on Windows.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#round-instance_method" title="#round (instance method)">#<strong>round</strong>(value) &#x21d2; Numeric </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Like [Fixnum.round], but leaves rooms for slight floating-point
differences.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#ruby2_4%3F-instance_method" title="#ruby2_4? (instance method)">#<strong>ruby2_4?</strong> &#x21d2; Boolean </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Whether or not this is running under Ruby 2.4 or higher.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#sass_warn-instance_method" title="#sass_warn (instance method)">#<strong>sass_warn</strong>(msg) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>The same as `Kernel#warn`, but is silenced by <span class='object_link'><a href="#silence_sass_warnings-instance_method" title="Sass::Util#silence_sass_warnings (method)">#silence_sass_warnings</a></span>.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#scope-instance_method" title="#scope (instance method)">#<strong>scope</strong>(file) &#x21d2; String </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns the path of a file relative to the Sass root directory.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#silence_sass_warnings-instance_method" title="#silence_sass_warnings (instance method)">#<strong>silence_sass_warnings</strong> { ... } &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Silences all Sass warnings within a block.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#slice_by-instance_method" title="#slice_by (instance method)">#<strong>slice_by</strong>(enum) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#sourcemap_name-instance_method" title="#sourcemap_name (instance method)">#<strong>sourcemap_name</strong>(css) &#x21d2; String </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Builds a sourcemap file name given the generated CSS file name.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#strip_string_array-instance_method" title="#strip_string_array (instance method)">#<strong>strip_string_array</strong>(arr) &#x21d2; Array </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Destructively strips whitespace from the beginning and end of the first and
last elements, respectively, in the array (if those elements are strings).</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#subsequence%3F-instance_method" title="#subsequence? (instance method)">#<strong>subsequence?</strong>(seq1, seq2) &#x21d2; Boolean </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns whether or not `seq1` is a subsequence of `seq2`.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#substitute-instance_method" title="#substitute (instance method)">#<strong>substitute</strong>(ary, from, to) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Substitutes a sub-array of one array with another sub-array.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#undefined_conversion_error_char-instance_method" title="#undefined_conversion_error_char (instance method)">#<strong>undefined_conversion_error_char</strong>(e) &#x21d2; String </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns a string description of the character that caused an
`Encoding::UndefinedConversionError`.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#upcase-instance_method" title="#upcase (instance method)">#<strong>upcase</strong>(string) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Like `String.upcase`, but only ever upcases ASCII letters.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#version_geq-instance_method" title="#version_geq (instance method)">#<strong>version_geq</strong>(v1, v2) &#x21d2; Boolean </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns whether one version string represents the same or a more recent
version than another.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#version_gt-instance_method" title="#version_gt (instance method)">#<strong>version_gt</strong>(v1, v2) &#x21d2; Boolean </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns whether one version string represents a more recent version than
another.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#windows%3F-instance_method" title="#windows? (instance method)">#<strong>windows?</strong> &#x21d2; Boolean </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Whether or not this is running on Windows.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#with_extracted_values-instance_method" title="#with_extracted_values (instance method)">#<strong>with_extracted_values</strong>(arr) {|str| ... } &#x21d2; Array </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Allows modifications to be performed on the string form of an array
containing both strings and non-strings.</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="abstract-instance_method">
#<strong>abstract</strong>(obj) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Throws a NotImplementedError for an abstract method.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>obj</span>
<span class='type'>(<tt>Object</tt>)</span>
&mdash;
<div class='inline'>
<p>`self`</p>
</div>
</li>
</ul>
<p class="tag_title">Raises:</p>
<ul class="raise">
<li>
<span class='type'>(<tt>NotImplementedError</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
444
445
446</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 444</span>
<span class='kw'>def</span> <span class='id identifier rubyid_abstract'>abstract</span><span class='lparen'>(</span><span class='id identifier rubyid_obj'>obj</span><span class='rparen'>)</span>
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>NotImplementedError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='embexpr_end'>}</span><span class='tstring_content'> must implement #</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_caller_info'>caller_info</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="ap_geq?-instance_method">
#<strong>ap_geq?</strong>(version) &#x21d2; <tt>Boolean</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns whether this environment is using ActionPack of a version greater
than or equal to that specified.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>version</span>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>The string version number to check against. Should be greater than or equal
to Rails 3, because otherwise ActionPack::VERSION isn&#39;t autoloaded</p>
</div>
</li>
</ul>
<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">
518
519
520
521
522
523
524</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 518</span>
<span class='kw'>def</span> <span class='id identifier rubyid_ap_geq?'>ap_geq?</span><span class='lparen'>(</span><span class='id identifier rubyid_version'>version</span><span class='rparen'>)</span>
<span class='comment'># The ActionPack module is always loaded automatically in Rails &gt;= 3
</span> <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='const'>ActionPack</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='const'>ActionPack</span><span class='op'>::</span><span class='const'>VERSION</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span>
<span class='kw'>defined?</span><span class='lparen'>(</span><span class='const'>ActionPack</span><span class='op'>::</span><span class='const'>VERSION</span><span class='op'>::</span><span class='const'>STRING</span><span class='rparen'>)</span>
<span class='id identifier rubyid_version_geq'>version_geq</span><span class='lparen'>(</span><span class='const'>ActionPack</span><span class='op'>::</span><span class='const'>VERSION</span><span class='op'>::</span><span class='const'>STRING</span><span class='comma'>,</span> <span class='id identifier rubyid_version'>version</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="ap_geq_3?-instance_method">
#<strong>ap_geq_3?</strong> &#x21d2; <tt>Boolean</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns whether this environment is using ActionPack version 3.0.0 or
greater.</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">
507
508
509</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 507</span>
<span class='kw'>def</span> <span class='id identifier rubyid_ap_geq_3?'>ap_geq_3?</span>
<span class='id identifier rubyid_ap_geq?'>ap_geq?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>3.0.0.beta1</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="array_minus-instance_method">
#<strong>array_minus</strong>(minuend, subtrahend) &#x21d2; <tt>Array</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns a sub-array of `minuend` containing only elements that are also in
`subtrahend`. Ensures that the return value has the same order as
`minuend`, even on Rubinius where that&#39;s not guaranteed by `Array#-`.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>minuend</span>
<span class='type'>(<tt>Array</tt>)</span>
</li>
<li>
<span class='name'>subtrahend</span>
<span class='type'>(<tt>Array</tt>)</span>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Array</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
317
318
319
320
321</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 317</span>
<span class='kw'>def</span> <span class='id identifier rubyid_array_minus'>array_minus</span><span class='lparen'>(</span><span class='id identifier rubyid_minuend'>minuend</span><span class='comma'>,</span> <span class='id identifier rubyid_subtrahend'>subtrahend</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='id identifier rubyid_minuend'>minuend</span> <span class='op'>-</span> <span class='id identifier rubyid_subtrahend'>subtrahend</span> <span class='kw'>unless</span> <span class='id identifier rubyid_rbx?'>rbx?</span>
<span class='id identifier rubyid_set'>set</span> <span class='op'>=</span> <span class='const'>Set</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_minuend'>minuend</span><span class='rparen'>)</span> <span class='op'>-</span> <span class='id identifier rubyid_subtrahend'>subtrahend</span>
<span class='id identifier rubyid_minuend'>minuend</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_e'>e</span><span class='op'>|</span> <span class='id identifier rubyid_set'>set</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_e'>e</span><span class='rparen'>)</span><span class='rbrace'>}</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="atomic_create_and_write_file-instance_method">
#<strong>atomic_create_and_write_file</strong>(filename, perms = 0666) {|tmpfile| ... } &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>This creates a temp file and yields it for writing. When the write is
complete, the file is moved into the desired location. The atomicity of
this operation is provided by the filesystem&#39;s rename operation.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>filename</span>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>The file to write to.</p>
</div>
</li>
<li>
<span class='name'>perms</span>
<span class='type'>(<tt>Integer</tt>)</span>
<em class="default">(defaults to: <tt>0666</tt>)</em>
&mdash;
<div class='inline'>
<p>The permissions used for creating this file. Will be masked by the process
umask. Defaults to readable/writeable by all users however the umask
usually changes this to only be writable by the process&#39;s user.</p>
</div>
</li>
</ul>
<p class="tag_title">Yield Parameters:</p>
<ul class="yieldparam">
<li>
<span class='name'>tmpfile</span>
<span class='type'>(<tt>Tempfile</tt>)</span>
&mdash;
<div class='inline'>
<p>The temp file that can be written to.</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'></span>
<div class='inline'>
<p>The value returned by the block.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 1007</span>
<span class='kw'>def</span> <span class='id identifier rubyid_atomic_create_and_write_file'>atomic_create_and_write_file</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='id identifier rubyid_perms'>perms</span> <span class='op'>=</span> <span class='int'>0666</span><span class='rparen'>)</span>
<span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>tempfile</span><span class='tstring_end'>&#39;</span></span>
<span class='id identifier rubyid_tmpfile'>tmpfile</span> <span class='op'>=</span> <span class='const'>Tempfile</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_basename'>basename</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='id identifier rubyid_tmpfile'>tmpfile</span><span class='period'>.</span><span class='id identifier rubyid_binmode'>binmode</span> <span class='kw'>if</span> <span class='id identifier rubyid_tmpfile'>tmpfile</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:binmode</span><span class='rparen'>)</span>
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='kw'>yield</span> <span class='id identifier rubyid_tmpfile'>tmpfile</span>
<span class='id identifier rubyid_tmpfile'>tmpfile</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
<span class='const'><span class='object_link'><a href="#ATOMIC_WRITE_MUTEX-constant" title="Sass::Util::ATOMIC_WRITE_MUTEX (constant)">ATOMIC_WRITE_MUTEX</a></span></span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='kw'>do</span>
<span class='kw'>begin</span>
<span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_chmod'>chmod</span><span class='lparen'>(</span><span class='id identifier rubyid_perms'>perms</span> <span class='op'>&amp;</span> <span class='op'>~</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_umask'>umask</span><span class='comma'>,</span> <span class='id identifier rubyid_tmpfile'>tmpfile</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
<span class='kw'>rescue</span> <span class='const'>Errno</span><span class='op'>::</span><span class='const'>EPERM</span>
<span class='comment'># If we don&#39;t have permissions to chmod the file, don&#39;t let that crash
</span> <span class='comment'># the compilation. See issue 1215.
</span> <span class='kw'>end</span>
<span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_rename'>rename</span> <span class='id identifier rubyid_tmpfile'>tmpfile</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_filename'>filename</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_result'>result</span>
<span class='kw'>ensure</span>
<span class='comment'># close and remove the tempfile if it still exists,
</span> <span class='comment'># presumably due to an error during write
</span> <span class='id identifier rubyid_tmpfile'>tmpfile</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span> <span class='kw'>if</span> <span class='id identifier rubyid_tmpfile'>tmpfile</span>
<span class='id identifier rubyid_tmpfile'>tmpfile</span><span class='period'>.</span><span class='id identifier rubyid_unlink'>unlink</span> <span class='kw'>if</span> <span class='id identifier rubyid_tmpfile'>tmpfile</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="av_template_class-instance_method">
#<strong>av_template_class</strong>(name) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns an ActionView::Template* class. In pre-3.0 versions of Rails, most
of these classes were of the form `ActionView::TemplateFoo`, while
afterwards they were of the form `ActionView;:Template::Foo`.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>name</span>
<span class='type'>(<tt>#to_s</tt>)</span>
&mdash;
<div class='inline'>
<p>The name of the class to get. For example, `:Error` will return
`ActionView::TemplateError` or `ActionView::Template::Error`.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
534
535
536
537</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 534</span>
<span class='kw'>def</span> <span class='id identifier rubyid_av_template_class'>av_template_class</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='const'>ActionView</span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Template</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='const'>ActionView</span><span class='period'>.</span><span class='id identifier rubyid_const_defined?'>const_defined?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Template</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='const'>ActionView</span><span class='op'>::</span><span class='const'>Template</span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</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='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="caller_info-instance_method">
#<strong>caller_info</strong>(entry = nil) &#x21d2; <tt>[String, Integer, (String, nil)]</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns information about the caller of the previous method.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>entry</span>
<span class='type'>(<tt>String</tt>)</span>
<em class="default">(defaults to: <tt>nil</tt>)</em>
&mdash;
<div class='inline'>
<p>An entry in the `#caller` list, or a similarly formatted string</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>[String, Integer, (String, nil)]</tt>)</span>
&mdash;
<div class='inline'>
<p>An array containing the filename, line, and method name of the caller. The
method name may be nil</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
392
393
394
395
396
397
398
399
400</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 392</span>
<span class='kw'>def</span> <span class='id identifier rubyid_caller_info'>caller_info</span><span class='lparen'>(</span><span class='id identifier rubyid_entry'>entry</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
<span class='comment'># JRuby evaluates `caller` incorrectly when it&#39;s in an actual default argument.
</span> <span class='id identifier rubyid_entry'>entry</span> <span class='op'>||=</span> <span class='id identifier rubyid_caller'>caller</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_info'>info</span> <span class='op'>=</span> <span class='id identifier rubyid_entry'>entry</span><span class='period'>.</span><span class='id identifier rubyid_scan'>scan</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^((?:[A-Za-z]:)?.*?):(-?.*?)(?::.*`(.+)&#39;)?$</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
<span class='id identifier rubyid_info'>info</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_info'>info</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
<span class='comment'># This is added by Rubinius to designate a block, but we don&#39;t care about it.
</span> <span class='id identifier rubyid_info'>info</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</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'> \{\}\Z</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_info'>info</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_info'>info</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="check_range-instance_method">
#<strong>check_range</strong>(name, range, value, unit = &#39;&#39;) &#x21d2; <tt>Numeric</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Asserts that `value` falls within `range` (inclusive), leaving room for
slight floating-point errors.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>name</span>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>The name of the value. Used in the error message.</p>
</div>
</li>
<li>
<span class='name'>range</span>
<span class='type'>(<tt>Range</tt>)</span>
&mdash;
<div class='inline'>
<p>The allowed range of values.</p>
</div>
</li>
<li>
<span class='name'>value</span>
<span class='type'>(<tt>Numeric</tt>, <tt><span class='object_link'><a href="Script/Value/Number.html" title="Sass::Script::Value::Number (class)">Sass::Script::Value::Number</a></span></tt>)</span>
&mdash;
<div class='inline'>
<p>The value to check.</p>
</div>
</li>
<li>
<span class='name'>unit</span>
<span class='type'>(<tt>String</tt>)</span>
<em class="default">(defaults to: <tt>&#39;&#39;</tt>)</em>
&mdash;
<div class='inline'>
<p>The unit of the value. Used in error reporting.</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Numeric</tt>)</span>
&mdash;
<div class='inline'>
<p>`value` adjusted to fall within range, if it was outside by a
floating-point margin.</p>
</div>
</li>
</ul>
<p class="tag_title">Raises:</p>
<ul class="raise">
<li>
<span class='type'>(<tt>ArgumentError</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
358
359
360
361
362
363
364
365
366
367</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 358</span>
<span class='kw'>def</span> <span class='id identifier rubyid_check_range'>check_range</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_range'>range</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_unit'>unit</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_grace'>grace</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='op'>-</span><span class='float'>0.00001</span><span class='op'>..</span><span class='float'>0.00001</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='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span> <span class='kw'>if</span> <span class='id identifier rubyid_value'>value</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="Script/Value.html" title="Sass::Script::Value (module)">Value</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Script/Value/Number.html" title="Sass::Script::Value::Number (class)">Number</a></span></span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>if</span> <span class='id identifier rubyid_range'>range</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='id identifier rubyid_range'>range</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='kw'>if</span> <span class='id identifier rubyid_grace'>grace</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>-</span> <span class='id identifier rubyid_range'>range</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='id identifier rubyid_range'>range</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span> <span class='kw'>if</span> <span class='id identifier rubyid_grace'>grace</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>-</span> <span class='id identifier rubyid_range'>range</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span><span class='rparen'>)</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'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_str'>str</span><span class='embexpr_end'>}</span><span class='tstring_content'> must be between </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_range'>range</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='embexpr_end'>}</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_unit'>unit</span><span class='embexpr_end'>}</span><span class='tstring_content'> and </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_range'>range</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span><span class='embexpr_end'>}</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_unit'>unit</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="check_sass_encoding-instance_method">
#<strong>check_sass_encoding</strong>(str) &#x21d2; <tt>(String, Encoding)</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Like #check_encoding, but also checks for a `@charset` declaration at the
beginning of the file and uses that encoding if it exists.</p>
<p>Sass follows CSS&#39;s decoding rules.</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>
&mdash;
<div class='inline'>
<p>The string of which to check the encoding</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>(String, Encoding)</tt>)</span>
&mdash;
<div class='inline'>
<p>The original string encoded as UTF-8, and the source encoding of the string</p>
</div>
</li>
</ul>
<p class="tag_title">Raises:</p>
<ul class="raise">
<li>
<span class='type'>(<tt>Encoding::UndefinedConversionError</tt>)</span>
&mdash;
<div class='inline'>
<p>if the source encoding cannot be converted to UTF-8</p>
</div>
</li>
<li>
<span class='type'>(<tt>ArgumentError</tt>)</span>
&mdash;
<div class='inline'>
<p>if the document uses an unknown encoding with `@charset`</p>
</div>
</li>
<li>
<span class='type'>(<tt><span class='object_link'><a href="SyntaxError.html" title="Sass::SyntaxError (class)">Sass::SyntaxError</a></span></tt>)</span>
&mdash;
<div class='inline'>
<p>If the document declares an encoding that doesn&#39;t match its contents,
or it doesn&#39;t declare an encoding and its contents are invalid in the
native encoding.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 739</span>
<span class='kw'>def</span> <span class='id identifier rubyid_check_sass_encoding'>check_sass_encoding</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='rparen'>)</span>
<span class='comment'># Determine the fallback encoding following section 3.2 of CSS Syntax Level 3 and Encodings:
</span> <span class='comment'># http://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#determine-the-fallback-encoding
</span> <span class='comment'># http://encoding.spec.whatwg.org/#decode
</span> <span class='id identifier rubyid_binary'>binary</span> <span class='op'>=</span> <span class='id identifier rubyid_str'>str</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span><span class='period'>.</span><span class='id identifier rubyid_force_encoding'>force_encoding</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>BINARY</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_binary'>binary</span><span class='period'>.</span><span class='id identifier rubyid_start_with?'>start_with?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="#UTF_8_BOM-constant" title="Sass::Util::UTF_8_BOM (constant)">UTF_8_BOM</a></span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_binary'>binary</span><span class='period'>.</span><span class='id identifier rubyid_slice!'>slice!</span> <span class='int'>0</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="#UTF_8_BOM-constant" title="Sass::Util::UTF_8_BOM (constant)">UTF_8_BOM</a></span></span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span>
<span class='id identifier rubyid_str'>str</span> <span class='op'>=</span> <span class='id identifier rubyid_binary'>binary</span><span class='period'>.</span><span class='id identifier rubyid_force_encoding'>force_encoding</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>UTF-8</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
<span class='kw'>elsif</span> <span class='id identifier rubyid_binary'>binary</span><span class='period'>.</span><span class='id identifier rubyid_start_with?'>start_with?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="#UTF_16BE_BOM-constant" title="Sass::Util::UTF_16BE_BOM (constant)">UTF_16BE_BOM</a></span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_binary'>binary</span><span class='period'>.</span><span class='id identifier rubyid_slice!'>slice!</span> <span class='int'>0</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="#UTF_16BE_BOM-constant" title="Sass::Util::UTF_16BE_BOM (constant)">UTF_16BE_BOM</a></span></span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span>
<span class='id identifier rubyid_str'>str</span> <span class='op'>=</span> <span class='id identifier rubyid_binary'>binary</span><span class='period'>.</span><span class='id identifier rubyid_force_encoding'>force_encoding</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>UTF-16BE</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
<span class='kw'>elsif</span> <span class='id identifier rubyid_binary'>binary</span><span class='period'>.</span><span class='id identifier rubyid_start_with?'>start_with?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="#UTF_16LE_BOM-constant" title="Sass::Util::UTF_16LE_BOM (constant)">UTF_16LE_BOM</a></span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_binary'>binary</span><span class='period'>.</span><span class='id identifier rubyid_slice!'>slice!</span> <span class='int'>0</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="#UTF_16LE_BOM-constant" title="Sass::Util::UTF_16LE_BOM (constant)">UTF_16LE_BOM</a></span></span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span>
<span class='id identifier rubyid_str'>str</span> <span class='op'>=</span> <span class='id identifier rubyid_binary'>binary</span><span class='period'>.</span><span class='id identifier rubyid_force_encoding'>force_encoding</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>UTF-16LE</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
<span class='kw'>elsif</span> <span class='id identifier rubyid_binary'>binary</span> <span class='op'>=~</span> <span class='const'><span class='object_link'><a href="#CHARSET_REGEXP-constant" title="Sass::Util::CHARSET_REGEXP (constant)">CHARSET_REGEXP</a></span></span>
<span class='id identifier rubyid_charset'>charset</span> <span class='op'>=</span> <span class='backref'>$1</span><span class='period'>.</span><span class='id identifier rubyid_force_encoding'>force_encoding</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>US-ASCII</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_encoding'>encoding</span> <span class='op'>=</span> <span class='const'>Encoding</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span><span class='lparen'>(</span><span class='id identifier rubyid_charset'>charset</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_encoding'>encoding</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>UTF-16</span><span class='tstring_end'>&#39;</span></span> <span class='op'>||</span> <span class='id identifier rubyid_encoding'>encoding</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>UTF-16BE</span><span class='tstring_end'>&#39;</span></span>
<span class='id identifier rubyid_encoding'>encoding</span> <span class='op'>=</span> <span class='const'>Encoding</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>UTF-8</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_str'>str</span> <span class='op'>=</span> <span class='id identifier rubyid_binary'>binary</span><span class='period'>.</span><span class='id identifier rubyid_force_encoding'>force_encoding</span><span class='lparen'>(</span><span class='id identifier rubyid_encoding'>encoding</span><span class='rparen'>)</span>
<span class='kw'>elsif</span> <span class='id identifier rubyid_str'>str</span><span class='period'>.</span><span class='id identifier rubyid_encoding'>encoding</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ASCII-8BIT</span><span class='tstring_end'>&quot;</span></span>
<span class='comment'># Normally we want to fall back on believing the Ruby string
</span> <span class='comment'># encoding, but if that&#39;s just binary we want to make sure
</span> <span class='comment'># it&#39;s valid UTF-8.
</span> <span class='id identifier rubyid_str'>str</span> <span class='op'>=</span> <span class='id identifier rubyid_str'>str</span><span class='period'>.</span><span class='id identifier rubyid_force_encoding'>force_encoding</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>utf-8</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_find_encoding_error'>find_encoding_error</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_str'>str</span><span class='period'>.</span><span class='id identifier rubyid_valid_encoding?'>valid_encoding?</span>
<span class='kw'>begin</span>
<span class='comment'># If the string is valid, preprocess it according to section 3.3 of CSS Syntax Level 3.
</span> <span class='kw'>return</span> <span class='id identifier rubyid_str'>str</span><span class='period'>.</span><span class='id identifier rubyid_encode'>encode</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>UTF-8</span><span class='tstring_end'>&quot;</span></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'>\r\n?|\f</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_tr'>tr</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\u0000</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'><EFBFBD></span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_str'>str</span><span class='period'>.</span><span class='id identifier rubyid_encoding'>encoding</span>
<span class='kw'>rescue</span> <span class='const'>EncodingError</span>
<span class='id identifier rubyid_find_encoding_error'>find_encoding_error</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</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="cleanpath-instance_method">
#<strong>cleanpath</strong>(path) &#x21d2; <tt>Pathname</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Like `Pathname#cleanpath`, but normalizes Windows paths to always use
backslash separators. Normally, `Pathname#cleanpath` actually does the
reverse it will convert backslashes to forward slashes, which can break
`Pathname#relative_path_from`.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>path</span>
<span class='type'>(<tt>String</tt>, <tt>Pathname</tt>)</span>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Pathname</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
615
616
617
618</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 615</span>
<span class='kw'>def</span> <span class='id identifier rubyid_cleanpath'>cleanpath</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
<span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Pathname</span><span class='rparen'>)</span>
<span class='id identifier rubyid_pathname'>pathname</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_cleanpath'>cleanpath</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="deprecated-instance_method">
#<strong>deprecated</strong>(obj, message = nil) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Prints a deprecation warning for the caller method.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>obj</span>
<span class='type'>(<tt>Object</tt>)</span>
&mdash;
<div class='inline'>
<p>`self`</p>
</div>
</li>
<li>
<span class='name'>message</span>
<span class='type'>(<tt>String</tt>)</span>
<em class="default">(defaults to: <tt>nil</tt>)</em>
&mdash;
<div class='inline'>
<p>A message describing what to do instead.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
452
453
454
455
456
457</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 452</span>
<span class='kw'>def</span> <span class='id identifier rubyid_deprecated'>deprecated</span><span class='lparen'>(</span><span class='id identifier rubyid_obj'>obj</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
<span class='id identifier rubyid_obj_class'>obj_class</span> <span class='op'>=</span> <span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Class</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_obj'>obj</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='embexpr_end'>}</span><span class='tstring_content'>#</span><span class='tstring_end'>&quot;</span></span>
<span class='id identifier rubyid_full_message'>full_message</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>DEPRECATION WARNING: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_obj_class'>obj_class</span><span class='embexpr_end'>}</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_caller_info'>caller_info</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span>
<span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>will be removed in a future version of Sass.</span><span class='embexpr_beg'>#{</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_message'>message</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_message'>message</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></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="" title="Sass::Util (module)">Util</a></span></span><span class='period'>.</span><span class='id identifier rubyid_sass_warn'><span class='object_link'><a href="#sass_warn-instance_method" title="Sass::Util#sass_warn (method)">sass_warn</a></span></span> <span class='id identifier rubyid_full_message'>full_message</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="destructure-instance_method">
#<strong>destructure</strong>(val) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Prepare a value for a destructuring assignment (e.g. `a, b = val`). This
works around a performance bug when using ActiveSupport, and only needs to
be called when `val` is likely to be `nil` reasonably often.</p>
<p>See [this bug report](<a
href="http://redmine.ruby-lang.org/issues/4917">redmine.ruby-lang.org/issues/4917</a>).</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>val</span>
<span class='type'>(<tt>Object</tt>)</span>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Object</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
700
701
702</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 700</span>
<span class='kw'>def</span> <span class='id identifier rubyid_destructure'>destructure</span><span class='lparen'>(</span><span class='id identifier rubyid_val'>val</span><span class='rparen'>)</span>
<span class='id identifier rubyid_val'>val</span> <span class='op'>||</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="downcase-instance_method">
#<strong>downcase</strong>(string) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Like `String.downcase`, but only ever downcases ASCII letters.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
305
306
307
308</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 305</span>
<span class='kw'>def</span> <span class='id identifier rubyid_downcase'>downcase</span><span class='lparen'>(</span><span class='id identifier rubyid_string'>string</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='id identifier rubyid_string'>string</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span> <span class='kw'>unless</span> <span class='id identifier rubyid_ruby2_4?'>ruby2_4?</span>
<span class='id identifier rubyid_string'>string</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='lparen'>(</span><span class='symbol'>:ascii</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="encode_vlq-instance_method">
#<strong>encode_vlq</strong>(value) &#x21d2; <tt>String</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Encodes `value` as VLQ (<a
href="http://en.wikipedia.org/wiki/VLQ">en.wikipedia.org/wiki/VLQ</a>).</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>Integer</tt>)</span>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>The encoded value</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 954</span>
<span class='kw'>def</span> <span class='id identifier rubyid_encode_vlq'>encode_vlq</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span> <span class='op'>&lt;</span> <span class='int'>0</span>
<span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='lparen'>(</span><span class='op'>-</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span> <span class='op'>&lt;&lt;</span> <span class='int'>1</span><span class='rparen'>)</span> <span class='op'>|</span> <span class='int'>1</span>
<span class='kw'>else</span>
<span class='id identifier rubyid_value'>value</span> <span class='op'>&lt;&lt;=</span> <span class='int'>1</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span>
<span class='kw'>begin</span>
<span class='id identifier rubyid_digit'>digit</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='op'>&amp;</span> <span class='const'><span class='object_link'><a href="#VLQ_BASE_MASK-constant" title="Sass::Util::VLQ_BASE_MASK (constant)">VLQ_BASE_MASK</a></span></span>
<span class='id identifier rubyid_value'>value</span> <span class='op'>&gt;&gt;=</span> <span class='const'><span class='object_link'><a href="#VLQ_BASE_SHIFT-constant" title="Sass::Util::VLQ_BASE_SHIFT (constant)">VLQ_BASE_SHIFT</a></span></span>
<span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span> <span class='op'>&gt;</span> <span class='int'>0</span>
<span class='id identifier rubyid_digit'>digit</span> <span class='op'>|=</span> <span class='const'><span class='object_link'><a href="#VLQ_CONTINUATION_BIT-constant" title="Sass::Util::VLQ_CONTINUATION_BIT (constant)">VLQ_CONTINUATION_BIT</a></span></span>
<span class='kw'>end</span>
<span class='id identifier rubyid_result'>result</span> <span class='op'>&lt;&lt;</span> <span class='const'><span class='object_link'><a href="#BASE64_DIGITS-constant" title="Sass::Util::BASE64_DIGITS (constant)">BASE64_DIGITS</a></span></span><span class='lbracket'>[</span><span class='id identifier rubyid_digit'>digit</span><span class='rbracket'>]</span>
<span class='kw'>end</span> <span class='kw'>while</span> <span class='id identifier rubyid_value'>value</span> <span class='op'>&gt;</span> <span class='int'>0</span>
<span class='id identifier rubyid_result'>result</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="extract!-instance_method">
#<strong>extract!</strong>(array) {|el| ... } &#x21d2; <tt>Array</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Destructively removes all elements from an array that match a block, and
returns the removed elements.</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</tt>)</span>
&mdash;
<div class='inline'>
<p>The array from which to remove elements.</p>
</div>
</li>
</ul>
<p class="tag_title">Yields:</p>
<ul class="yield">
<li>
<span class='type'>(<tt>el</tt>)</span>
&mdash;
<div class='inline'>
<p>Called for each element.</p>
</div>
</li>
</ul>
<p class="tag_title">Yield Parameters:</p>
<ul class="yieldparam">
<li>
<span class='name'>el</span>
<span class='type'>(<tt>*</tt>)</span>
&mdash;
<div class='inline'>
<p>The element to test.</p>
</div>
</li>
</ul>
<p class="tag_title">Yield Returns:</p>
<ul class="yieldreturn">
<li>
<span class='type'>(<tt>Boolean</tt>)</span>
&mdash;
<div class='inline'>
<p>Whether or not to extract the element.</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Array</tt>)</span>
&mdash;
<div class='inline'>
<p>The extracted elements.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
785
786
787
788
789
790
791
792
793</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 785</span>
<span class='kw'>def</span> <span class='id identifier rubyid_extract!'>extract!</span><span class='lparen'>(</span><span class='id identifier rubyid_array'>array</span><span class='rparen'>)</span>
<span class='id identifier rubyid_out'>out</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_array'>array</span><span class='period'>.</span><span class='id identifier rubyid_reject!'>reject!</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_e'>e</span><span class='op'>|</span>
<span class='kw'>next</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='kw'>yield</span> <span class='id identifier rubyid_e'>e</span>
<span class='id identifier rubyid_out'>out</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_e'>e</span>
<span class='kw'>true</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_out'>out</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="extract_values-instance_method">
#<strong>extract_values</strong>(arr) &#x21d2; <tt>(String, Array)</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Extracts the non-string vlaues from an array containing both strings and
non-strings. These values are replaced with escape sequences. This can be
undone using <span class='object_link'><a href="#inject_values-instance_method" title="Sass::Util#inject_values (method)">#inject_values</a></span>.</p>
<p>This is useful e.g. when we want to do string manipulation on an
interpolated string.</p>
<p>The precise format of the resulting string is not guaranteed. However, it
is guaranteed that newlines and whitespace won&#39;t be affected.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>arr</span>
<span class='type'>(<tt>Array</tt>)</span>
&mdash;
<div class='inline'>
<p>The array from which values are extracted.</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>(String, Array)</tt>)</span>
&mdash;
<div class='inline'>
<p>The resulting string, and an array of extracted values.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
839
840
841
842
843
844
845
846
847</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 839</span>
<span class='kw'>def</span> <span class='id identifier rubyid_extract_values'>extract_values</span><span class='lparen'>(</span><span class='id identifier rubyid_arr'>arr</span><span class='rparen'>)</span>
<span class='id identifier rubyid_values'>values</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_mapped'>mapped</span> <span class='op'>=</span> <span class='id identifier rubyid_arr'>arr</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_e'>e</span><span class='op'>|</span>
<span class='kw'>next</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>{</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>{{</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
<span class='id identifier rubyid_values'>values</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_e'>e</span>
<span class='kw'>next</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>{</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>-</span> <span class='int'>1</span><span class='embexpr_end'>}</span><span class='tstring_content'>}</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span>
<span class='kw'>return</span> <span class='id identifier rubyid_mapped'>mapped</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='comma'>,</span> <span class='id identifier rubyid_values'>values</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="file_uri_from_path-instance_method">
#<strong>file_uri_from_path</strong>(path) &#x21d2; <tt>String</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Converts `path` to a “file:” URI. This handles Windows paths correctly.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>path</span>
<span class='type'>(<tt>String</tt>, <tt>Pathname</tt>)</span>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>String</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
666
667
668
669
670
671
672
673
674</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 666</span>
<span class='kw'>def</span> <span class='id identifier rubyid_file_uri_from_path'>file_uri_from_path</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
<span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='kw'>if</span> <span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Pathname</span><span class='rparen'>)</span>
<span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_tr'>tr</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>\\</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>/</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_windows?'>windows?</span>
<span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='const'>URI</span><span class='op'>::</span><span class='const'>DEFAULT_PARSER</span><span class='period'>.</span><span class='id identifier rubyid_escape'>escape</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_start_with?'>start_with?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>/</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>file://</span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_path'>path</span> <span class='op'>:</span> <span class='id identifier rubyid_path'>path</span> <span class='kw'>unless</span> <span class='id identifier rubyid_windows?'>windows?</span>
<span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>file:///</span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_tr'>tr</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\\</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_path'>path</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>%r{</span><span class='tstring_content'>^[a-zA-Z]:[/\\]</span><span class='regexp_end'>}</span></span>
<span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>file:</span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_tr'>tr</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\\</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_path'>path</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>%r{</span><span class='tstring_content'>\\\\[^\\]+\\[^\\/]+</span><span class='regexp_end'>}</span></span>
<span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_tr'>tr</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\\</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="flatten_vertically-instance_method">
#<strong>flatten_vertically</strong>(arrs) &#x21d2; <tt>Array</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Flattens the first level of nested arrays in `arrs`. Unlike
`Array#flatten`, this orders the result by taking the first values from
each array in order, then the second, and so on.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>arrs</span>
<span class='type'>(<tt>Array</tt>)</span>
&mdash;
<div class='inline'>
<p>The array to flatten.</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Array</tt>)</span>
&mdash;
<div class='inline'>
<p>The flattened array.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
801
802
803
804
805
806
807
808
809
810
811</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 801</span>
<span class='kw'>def</span> <span class='id identifier rubyid_flatten_vertically'>flatten_vertically</span><span class='lparen'>(</span><span class='id identifier rubyid_arrs'>arrs</span><span class='rparen'>)</span>
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_arrs'>arrs</span> <span class='op'>=</span> <span class='id identifier rubyid_arrs'>arrs</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_sub'>sub</span><span class='op'>|</span> <span class='id identifier rubyid_sub'>sub</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='op'>?</span> <span class='id identifier rubyid_sub'>sub</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span> <span class='op'>:</span> <span class='const'>Array</span><span class='lparen'>(</span><span class='id identifier rubyid_sub'>sub</span><span class='rparen'>)</span><span class='rbrace'>}</span>
<span class='kw'>until</span> <span class='id identifier rubyid_arrs'>arrs</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
<span class='id identifier rubyid_arrs'>arrs</span><span class='period'>.</span><span class='id identifier rubyid_reject!'>reject!</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_arr'>arr</span><span class='op'>|</span>
<span class='id identifier rubyid_result'>result</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_arr'>arr</span><span class='period'>.</span><span class='id identifier rubyid_shift'>shift</span>
<span class='id identifier rubyid_arr'>arr</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_result'>result</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="glob-instance_method">
#<strong>glob</strong>(path) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Like `Dir.glob`, but works with backslash-separated paths on Windows.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>path</span>
<span class='type'>(<tt>String</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
586
587
588
589
590
591
592
593</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 586</span>
<span class='kw'>def</span> <span class='id identifier rubyid_glob'>glob</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
<span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_tr'>tr</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>\\</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>/</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_windows?'>windows?</span>
<span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
<span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_glob'>glob</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_f'>f</span><span class='op'>|</span> <span class='kw'>yield</span><span class='lparen'>(</span><span class='id identifier rubyid_f'>f</span><span class='rparen'>)</span><span class='rbrace'>}</span>
<span class='kw'>else</span>
<span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_glob'>glob</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</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="inject_values-instance_method">
#<strong>inject_values</strong>(str, values) &#x21d2; <tt>Array</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Undoes <span class='object_link'><a href="#extract_values-instance_method" title="Sass::Util#extract_values (method)">#extract_values</a></span> by transforming a string with escape sequences
into an array of strings and non-string values.</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>
&mdash;
<div class='inline'>
<p>The string with escape sequences.</p>
</div>
</li>
<li>
<span class='name'>values</span>
<span class='type'>(<tt>Array</tt>)</span>
&mdash;
<div class='inline'>
<p>The array of values to inject.</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Array</tt>)</span>
&mdash;
<div class='inline'>
<p>The array of strings and values.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
855
856
857
858
859
860
861
862
863</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 855</span>
<span class='kw'>def</span> <span class='id identifier rubyid_inject_values'>inject_values</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='comma'>,</span> <span class='id identifier rubyid_values'>values</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='lbracket'>[</span><span class='id identifier rubyid_str'>str</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>{{</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>{</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
<span class='comment'># Add an extra { so that we process the tail end of the string
</span> <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>{{</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_scan'>scan</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>(.*?)(?:(\{\{)|\{(\d+)\})</span><span class='regexp_end'>/m</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='lparen'>(</span><span class='id identifier rubyid_pre'>pre</span><span class='comma'>,</span> <span class='id identifier rubyid_esc'>esc</span><span class='comma'>,</span> <span class='id identifier rubyid_n'>n</span><span class='rparen'>)</span><span class='op'>|</span>
<span class='lbracket'>[</span><span class='id identifier rubyid_pre'>pre</span><span class='comma'>,</span> <span class='id identifier rubyid_esc'>esc</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>{</span><span class='tstring_end'>&#39;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_n'>n</span> <span class='op'>?</span> <span class='id identifier rubyid_values'>values</span><span class='lbracket'>[</span><span class='id identifier rubyid_n'>n</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
<span class='kw'>end</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
<span class='id identifier rubyid_result'>result</span><span class='lbracket'>[</span><span class='op'>-</span><span class='int'>2</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span> <span class='comment'># Get rid of the extra {
</span> <span class='id identifier rubyid_merge_adjacent_strings'>merge_adjacent_strings</span><span class='lparen'>(</span><span class='id identifier rubyid_result'>result</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_reject'>reject</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_s'>s</span><span class='op'>|</span> <span class='id identifier rubyid_s'>s</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span><span class='rbrace'>}</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="inspect_obj-instance_method">
#<strong>inspect_obj</strong>(obj) &#x21d2; <tt>String</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Like `Object#inspect`, but preserves non-ASCII characters rather than
escaping them under Ruby 1.9.2. This is necessary so that the precompiled
Haml template can be `#encode`d into `@<a href=":encoding">options</a>`
before being evaluated.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>obj</span>
<span class='type'>(<tt>Object</tt>)</span>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>String</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
820
821
822
823
824
825</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 820</span>
<span class='kw'>def</span> <span class='id identifier rubyid_inspect_obj'>inspect_obj</span><span class='lparen'>(</span><span class='id identifier rubyid_obj'>obj</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span> <span class='kw'>unless</span> <span class='id identifier rubyid_version_geq'>version_geq</span><span class='lparen'>(</span><span class='const'>RUBY_VERSION</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>1.9.2</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>:</span><span class='tstring_end'>&#39;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_inspect_obj'>inspect_obj</span><span class='lparen'>(</span><span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_obj'>obj</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='kw'>return</span> <span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span> <span class='kw'>unless</span> <span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
<span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>&quot;</span><span class='tstring_end'>&#39;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_obj'>obj</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'>[\x00-\x7F]+</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_s'>s</span><span class='op'>|</span> <span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='lbracket'>[</span><span class='int'>1</span><span class='op'>...</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rbrace'>}</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>&quot;</span><span class='tstring_end'>&#39;</span></span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="intersperse-instance_method">
#<strong>intersperse</strong>(enum, val) &#x21d2; <tt>Array</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Intersperses a value in an enumerable, as would be done with `Array#join`
but without concatenating the array together afterwards.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>enum</span>
<span class='type'>(<tt>Enumerable</tt>)</span>
</li>
<li>
<span class='name'>val</span>
<span class='type'></span>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Array</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
217
218
219</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 217</span>
<span class='kw'>def</span> <span class='id identifier rubyid_intersperse'>intersperse</span><span class='lparen'>(</span><span class='id identifier rubyid_enum'>enum</span><span class='comma'>,</span> <span class='id identifier rubyid_val'>val</span><span class='rparen'>)</span>
<span class='id identifier rubyid_enum'>enum</span><span class='period'>.</span><span class='id identifier rubyid_inject'>inject</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='comma'>,</span> <span class='id identifier rubyid_e'>e</span><span class='op'>|</span> <span class='id identifier rubyid_a'>a</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_e'>e</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_val'>val</span><span class='rbrace'>}</span><span class='lbracket'>[</span><span class='int'>0</span><span class='op'>...</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="ironruby?-instance_method">
#<strong>ironruby?</strong> &#x21d2; <tt>Boolean</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Whether or not this is running on IronRuby.</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">
555
556
557
558</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 555</span>
<span class='kw'>def</span> <span class='id identifier rubyid_ironruby?'>ironruby?</span>
<span class='kw'>return</span> <span class='ivar'>@ironruby</span> <span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='ivar'>@ironruby</span><span class='rparen'>)</span>
<span class='ivar'>@ironruby</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="#RUBY_ENGINE-constant" title="Sass::Util::RUBY_ENGINE (constant)">RUBY_ENGINE</a></span></span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ironruby</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="jruby?-instance_method">
#<strong>jruby?</strong> &#x21d2; <tt>Boolean</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Whether or not this is running on JRuby.</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">
571
572
573
574</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 571</span>
<span class='kw'>def</span> <span class='id identifier rubyid_jruby?'>jruby?</span>
<span class='kw'>return</span> <span class='ivar'>@jruby</span> <span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='ivar'>@jruby</span><span class='rparen'>)</span>
<span class='ivar'>@jruby</span> <span class='op'>=</span> <span class='const'>RUBY_PLATFORM</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>java</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="jruby_version-instance_method">
#<strong>jruby_version</strong> &#x21d2; <tt>Array&lt;Integer&gt;</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns an array of ints representing the JRuby version number.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Array&lt;Integer&gt;</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
579
580
581</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 579</span>
<span class='kw'>def</span> <span class='id identifier rubyid_jruby_version'>jruby_version</span>
<span class='ivar'>@jruby_version</span> <span class='op'>||=</span> <span class='op'>::</span><span class='const'>JRUBY_VERSION</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_s'>s</span><span class='op'>|</span> <span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='rbrace'>}</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="json_escape_string-instance_method">
#<strong>json_escape_string</strong>(s) &#x21d2; <tt>String</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Escapes certain characters so that the result can be used as the JSON
string value. Returns the original string if no escaping is necessary.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>s</span>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>The string to be escaped</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>The escaped string</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 893</span>
<span class='kw'>def</span> <span class='id identifier rubyid_json_escape_string'>json_escape_string</span><span class='lparen'>(</span><span class='id identifier rubyid_s'>s</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='id identifier rubyid_s'>s</span> <span class='kw'>if</span> <span class='id identifier rubyid_s'>s</span> <span class='op'>!~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>[&quot;\\\b\f\n\r\t]</span><span class='regexp_end'>/</span></span>
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span>
<span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='op'>|</span>
<span class='kw'>case</span> <span class='id identifier rubyid_c'>c</span>
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>&quot;</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\\</span><span class='tstring_end'>&quot;</span></span>
<span class='id identifier rubyid_result'>result</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\\</span><span class='tstring_end'>&quot;</span></span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_c'>c</span>
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>then</span> <span class='id identifier rubyid_result'>result</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\\n</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\t</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>then</span> <span class='id identifier rubyid_result'>result</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\\t</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\r</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>then</span> <span class='id identifier rubyid_result'>result</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\\r</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\f</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>then</span> <span class='id identifier rubyid_result'>result</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\\f</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\b</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>then</span> <span class='id identifier rubyid_result'>result</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\\b</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>else</span>
<span class='id identifier rubyid_result'>result</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_c'>c</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_result'>result</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="json_value_of-instance_method">
#<strong>json_value_of</strong>(v) &#x21d2; <tt>String</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Converts the argument into a valid JSON value.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>v</span>
<span class='type'>(<tt>Integer</tt>, <tt>String</tt>, <tt>Array</tt>, <tt>Boolean</tt>, <tt>nil</tt>)</span>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>String</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 917</span>
<span class='kw'>def</span> <span class='id identifier rubyid_json_value_of'>json_value_of</span><span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span><span class='rparen'>)</span>
<span class='kw'>case</span> <span class='id identifier rubyid_v'>v</span>
<span class='kw'>when</span> <span class='const'>Integer</span>
<span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
<span class='kw'>when</span> <span class='const'>String</span>
<span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\&quot;</span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_json_escape_string'>json_escape_string</span><span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\&quot;</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>when</span> <span class='const'>Array</span>
<span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>[</span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_x'>x</span><span class='op'>|</span> <span class='id identifier rubyid_json_value_of'>json_value_of</span><span class='lparen'>(</span><span class='id identifier rubyid_x'>x</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>,</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>]</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>when</span> <span class='const'>NilClass</span>
<span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>null</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>when</span> <span class='const'>TrueClass</span>
<span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>true</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>when</span> <span class='const'>FalseClass</span>
<span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>false</span><span class='tstring_end'>&quot;</span></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'>&quot;</span><span class='tstring_content'>Unknown type: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></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="lcs-instance_method">
#<strong>lcs</strong>(x, y) {|a, b| ... } &#x21d2; <tt>Array</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Computes a single longest common subsequence for `x` and `y`. If there are
more than one longest common subsequences, the one returned is that which
starts first in `x`.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>x</span>
<span class='type'>(<tt>Array</tt>)</span>
</li>
<li>
<span class='name'>y</span>
<span class='type'>(<tt>Array</tt>)</span>
</li>
</ul>
<p class="tag_title">Yields:</p>
<ul class="yield">
<li>
<span class='type'>(<tt>a</tt>, <tt>b</tt>)</span>
&mdash;
<div class='inline'>
<p>An optional block to use in place of a check for equality between elements
of `x` and `y`.</p>
</div>
</li>
</ul>
<p class="tag_title">Yield Returns:</p>
<ul class="yieldreturn">
<li>
<span class='type'>(<tt>Object</tt>, <tt>nil</tt>)</span>
&mdash;
<div class='inline'>
<p>If the two values register as equal, this will return the value to use in
the LCS array.</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Array</tt>)</span>
&mdash;
<div class='inline'>
<p>The LCS</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
291
292
293
294
295
296</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 291</span>
<span class='kw'>def</span> <span class='id identifier rubyid_lcs'>lcs</span><span class='lparen'>(</span><span class='id identifier rubyid_x'>x</span><span class='comma'>,</span> <span class='id identifier rubyid_y'>y</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
<span class='id identifier rubyid_x'>x</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_x'>x</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_y'>y</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_y'>y</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_block'>block</span> <span class='op'>||=</span> <span class='id identifier rubyid_proc'>proc</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='comma'>,</span> <span class='id identifier rubyid_b'>b</span><span class='op'>|</span> <span class='id identifier rubyid_a'>a</span> <span class='op'>==</span> <span class='id identifier rubyid_b'>b</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_a'>a</span><span class='rbrace'>}</span>
<span class='id identifier rubyid_lcs_backtrace'>lcs_backtrace</span><span class='lparen'>(</span><span class='id identifier rubyid_lcs_table'>lcs_table</span><span class='lparen'>(</span><span class='id identifier rubyid_x'>x</span><span class='comma'>,</span> <span class='id identifier rubyid_y'>y</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_x'>x</span><span class='comma'>,</span> <span class='id identifier rubyid_y'>y</span><span class='comma'>,</span> <span class='id identifier rubyid_x'>x</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>-</span> <span class='int'>1</span><span class='comma'>,</span> <span class='id identifier rubyid_y'>y</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>-</span> <span class='int'>1</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="map_hash-instance_method">
#<strong>map_hash</strong>(hash) {|key, value| ... } &#x21d2; <tt>Hash</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Maps the key-value pairs of a hash according to a block.</p>
</div>
</div>
<div class="tags">
<div class="examples">
<p class="tag_title">Examples:</p>
<pre class="example code"><code><span class='id identifier rubyid_map_hash'>map_hash</span><span class='lparen'>(</span><span class='lbrace'>{</span><span class='symbol'>:foo</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>bar</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='symbol'>:baz</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>bang</span><span class='tstring_end'>&quot;</span></span><span class='rbrace'>}</span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
<span class='comment'>#=&gt; {&quot;foo&quot; =&gt; :bar, &quot;baz&quot; =&gt; :bang}</span></code></pre>
</div>
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>hash</span>
<span class='type'>(<tt>Hash</tt>)</span>
&mdash;
<div class='inline'>
<p>The hash to map</p>
</div>
</li>
</ul>
<p class="tag_title">Yields:</p>
<ul class="yield">
<li>
<span class='type'>(<tt>key</tt>, <tt>value</tt>)</span>
&mdash;
<div class='inline'>
<p>A block in which the key-value pairs are transformed</p>
</div>
</li>
</ul>
<p class="tag_title">Yield Parameters:</p>
<ul class="yieldparam">
<li>
<span class='name'>The</span>
<span class='type'>(<tt>key</tt>)</span>
&mdash;
<div class='inline'>
<p>hash key</p>
</div>
</li>
<li>
<span class='name'>The</span>
<span class='type'>(<tt>value</tt>)</span>
&mdash;
<div class='inline'>
<p>hash value</p>
</div>
</li>
</ul>
<p class="tag_title">Yield Returns:</p>
<ul class="yieldreturn">
<li>
<span class='type'>(<tt>(Object, Object)</tt>)</span>
&mdash;
<div class='inline'>
<p>The new value for the `[key, value]` pair</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Hash</tt>)</span>
&mdash;
<div class='inline'>
<p>The mapped hash</p>
</div>
</li>
</ul>
<p class="tag_title">See Also:</p>
<ul class="see">
<li><span class='object_link'><a href="#map_keys-instance_method" title="Sass::Util#map_keys (method)">#map_keys</a></span></li>
<li><span class='object_link'><a href="#map_vals-instance_method" title="Sass::Util#map_vals (method)">#map_vals</a></span></li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
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/util.rb', line 90</span>
<span class='kw'>def</span> <span class='id identifier rubyid_map_hash'>map_hash</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
<span class='comment'># Copy and modify is more performant than mapping to an array and using
</span> <span class='comment'># to_hash on the result.
</span> <span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
<span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
<span class='id identifier rubyid_new_key'>new_key</span><span class='comma'>,</span> <span class='id identifier rubyid_new_value'>new_value</span> <span class='op'>=</span> <span class='kw'>yield</span><span class='lparen'>(</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='rparen'>)</span>
<span class='id identifier rubyid_new_key'>new_key</span> <span class='op'>=</span> <span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_denormalize'>denormalize</span><span class='lparen'>(</span><span class='id identifier rubyid_new_key'>new_key</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_hash'>hash</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="Util/NormalizedMap.html" title="Sass::Util::NormalizedMap (class)">NormalizedMap</a></span></span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_new_key'>new_key</span> <span class='op'>==</span> <span class='id identifier rubyid_k'>k</span>
<span class='id identifier rubyid_rv'>rv</span><span class='lbracket'>[</span><span class='id identifier rubyid_new_key'>new_key</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_new_value'>new_value</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="map_keys-instance_method">
#<strong>map_keys</strong>(hash) {|key| ... } &#x21d2; <tt>Hash</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Maps the keys in a hash according to a block.</p>
</div>
</div>
<div class="tags">
<div class="examples">
<p class="tag_title">Examples:</p>
<pre class="example code"><code><span class='id identifier rubyid_map_keys'>map_keys</span><span class='lparen'>(</span><span class='lbrace'>{</span><span class='symbol'>:foo</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>bar</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='symbol'>:baz</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>bang</span><span class='tstring_end'>&quot;</span></span><span class='rbrace'>}</span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='op'>|</span> <span class='id identifier rubyid_k'>k</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rbrace'>}</span>
<span class='comment'>#=&gt; {&quot;foo&quot; =&gt; &quot;bar&quot;, &quot;baz&quot; =&gt; &quot;bang&quot;}</span></code></pre>
</div>
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>hash</span>
<span class='type'>(<tt>Hash</tt>)</span>
&mdash;
<div class='inline'>
<p>The hash to map</p>
</div>
</li>
</ul>
<p class="tag_title">Yields:</p>
<ul class="yield">
<li>
<span class='type'>(<tt>key</tt>)</span>
&mdash;
<div class='inline'>
<p>A block in which the keys are transformed</p>
</div>
</li>
</ul>
<p class="tag_title">Yield Parameters:</p>
<ul class="yieldparam">
<li>
<span class='name'>key</span>
<span class='type'>(<tt>Object</tt>)</span>
&mdash;
<div class='inline'>
<p>The key that should be mapped</p>
</div>
</li>
</ul>
<p class="tag_title">Yield Returns:</p>
<ul class="yieldreturn">
<li>
<span class='type'>(<tt>Object</tt>)</span>
&mdash;
<div class='inline'>
<p>The new value for the key</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Hash</tt>)</span>
&mdash;
<div class='inline'>
<p>The mapped hash</p>
</div>
</li>
</ul>
<p class="tag_title">See Also:</p>
<ul class="see">
<li><span class='object_link'><a href="#map_vals-instance_method" title="Sass::Util#map_vals (method)">#map_vals</a></span></li>
<li><span class='object_link'><a href="#map_hash-instance_method" title="Sass::Util#map_hash (method)">#map_hash</a></span></li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
50
51
52</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 50</span>
<span class='kw'>def</span> <span class='id identifier rubyid_map_keys'>map_keys</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
<span class='id identifier rubyid_map_hash'>map_hash</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='lbracket'>[</span><span class='kw'>yield</span><span class='lparen'>(</span><span class='id identifier rubyid_k'>k</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="map_vals-instance_method">
#<strong>map_vals</strong>(hash) {|value| ... } &#x21d2; <tt>Hash</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Maps the values in a hash according to a block.</p>
</div>
</div>
<div class="tags">
<div class="examples">
<p class="tag_title">Examples:</p>
<pre class="example code"><code><span class='id identifier rubyid_map_values'>map_values</span><span class='lparen'>(</span><span class='lbrace'>{</span><span class='symbol'>:foo</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>bar</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='symbol'>:baz</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>bang</span><span class='tstring_end'>&quot;</span></span><span class='rbrace'>}</span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbrace'>}</span>
<span class='comment'>#=&gt; {:foo =&gt; :bar, :baz =&gt; :bang}</span></code></pre>
</div>
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>hash</span>
<span class='type'>(<tt>Hash</tt>)</span>
&mdash;
<div class='inline'>
<p>The hash to map</p>
</div>
</li>
</ul>
<p class="tag_title">Yields:</p>
<ul class="yield">
<li>
<span class='type'>(<tt>value</tt>)</span>
&mdash;
<div class='inline'>
<p>A block in which the values are transformed</p>
</div>
</li>
</ul>
<p class="tag_title">Yield Parameters:</p>
<ul class="yieldparam">
<li>
<span class='name'>value</span>
<span class='type'>(<tt>Object</tt>)</span>
&mdash;
<div class='inline'>
<p>The value that should be mapped</p>
</div>
</li>
</ul>
<p class="tag_title">Yield Returns:</p>
<ul class="yieldreturn">
<li>
<span class='type'>(<tt>Object</tt>)</span>
&mdash;
<div class='inline'>
<p>The new value for the value</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Hash</tt>)</span>
&mdash;
<div class='inline'>
<p>The mapped hash</p>
</div>
</li>
</ul>
<p class="tag_title">See Also:</p>
<ul class="see">
<li><span class='object_link'><a href="#map_keys-instance_method" title="Sass::Util#map_keys (method)">#map_keys</a></span></li>
<li><span class='object_link'><a href="#map_hash-instance_method" title="Sass::Util#map_hash (method)">#map_hash</a></span></li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
66
67
68
69
70
71
72
73
74
75</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 66</span>
<span class='kw'>def</span> <span class='id identifier rubyid_map_vals'>map_vals</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
<span class='comment'># We don&#39;t delegate to map_hash for performance here
</span> <span class='comment'># because map_hash does more than is necessary.
</span> <span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
<span class='id identifier rubyid_hash'>hash</span> <span class='op'>=</span> <span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_as_stored'>as_stored</span> <span class='kw'>if</span> <span class='id identifier rubyid_hash'>hash</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="Util/NormalizedMap.html" title="Sass::Util::NormalizedMap (class)">NormalizedMap</a></span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
<span class='id identifier rubyid_rv'>rv</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>yield</span><span class='lparen'>(</span><span class='id identifier rubyid_v'>v</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="max-instance_method">
#<strong>max</strong>(val1, val2) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the maximum of `val1` and `val2`. We use this over Array.max to
avoid unnecessary garbage collection.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
325
326
327</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 325</span>
<span class='kw'>def</span> <span class='id identifier rubyid_max'>max</span><span class='lparen'>(</span><span class='id identifier rubyid_val1'>val1</span><span class='comma'>,</span> <span class='id identifier rubyid_val2'>val2</span><span class='rparen'>)</span>
<span class='id identifier rubyid_val1'>val1</span> <span class='op'>&gt;</span> <span class='id identifier rubyid_val2'>val2</span> <span class='op'>?</span> <span class='id identifier rubyid_val1'>val1</span> <span class='op'>:</span> <span class='id identifier rubyid_val2'>val2</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="merge_adjacent_strings-instance_method">
#<strong>merge_adjacent_strings</strong>(arr) &#x21d2; <tt>Array</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Concatenates all strings that are adjacent in an array, while leaving other
elements as they are.</p>
</div>
</div>
<div class="tags">
<div class="examples">
<p class="tag_title">Examples:</p>
<pre class="example code"><code><span class='id identifier rubyid_merge_adjacent_strings'>merge_adjacent_strings</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='int'>1</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>foo</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>bar</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='int'>2</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>baz</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
<span class='comment'>#=&gt; [1, &quot;foobar&quot;, 2, &quot;baz&quot;]</span></code></pre>
</div>
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>arr</span>
<span class='type'>(<tt>Array</tt>)</span>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Array</tt>)</span>
&mdash;
<div class='inline'>
<p>The enumerable with strings merged</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 157</span>
<span class='kw'>def</span> <span class='id identifier rubyid_merge_adjacent_strings'>merge_adjacent_strings</span><span class='lparen'>(</span><span class='id identifier rubyid_arr'>arr</span><span class='rparen'>)</span>
<span class='comment'># Optimize for the common case of one element
</span> <span class='kw'>return</span> <span class='id identifier rubyid_arr'>arr</span> <span class='kw'>if</span> <span class='id identifier rubyid_arr'>arr</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>&lt;</span> <span class='int'>2</span>
<span class='id identifier rubyid_arr'>arr</span><span class='period'>.</span><span class='id identifier rubyid_inject'>inject</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='comma'>,</span> <span class='id identifier rubyid_e'>e</span><span class='op'>|</span>
<span class='kw'>if</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_a'>a</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'>String</span><span class='rparen'>)</span>
<span class='id identifier rubyid_a'>a</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_e'>e</span>
<span class='kw'>else</span>
<span class='id identifier rubyid_a'>a</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span>
<span class='kw'>end</span>
<span class='kw'>else</span>
<span class='id identifier rubyid_a'>a</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_e'>e</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_a'>a</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="min-instance_method">
#<strong>min</strong>(val1, val2) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the minimum of `val1` and `val2`. We use this over Array.min to
avoid unnecessary garbage collection.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
331
332
333</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 331</span>
<span class='kw'>def</span> <span class='id identifier rubyid_min'>min</span><span class='lparen'>(</span><span class='id identifier rubyid_val1'>val1</span><span class='comma'>,</span> <span class='id identifier rubyid_val2'>val2</span><span class='rparen'>)</span>
<span class='id identifier rubyid_val1'>val1</span> <span class='op'>&lt;=</span> <span class='id identifier rubyid_val2'>val2</span> <span class='op'>?</span> <span class='id identifier rubyid_val1'>val1</span> <span class='op'>:</span> <span class='id identifier rubyid_val2'>val2</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="pathname-instance_method">
#<strong>pathname</strong>(path) &#x21d2; <tt>Pathname</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Like `Pathname.new`, but normalizes Windows paths to always use backslash
separators.</p>
<p>`Pathname#relative_path_from` can break if the two pathnames aren&#39;t
consistent in their slash style.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>path</span>
<span class='type'>(<tt>String</tt>)</span>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Pathname</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
603
604
605
606</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 603</span>
<span class='kw'>def</span> <span class='id identifier rubyid_pathname'>pathname</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
<span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_tr'>tr</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\\</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_windows?'>windows?</span>
<span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="paths-instance_method">
#<strong>paths</strong>(arrs) &#x21d2; <tt>Array&lt;Arrays&gt;</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Return an array of all possible paths through the given arrays.</p>
</div>
</div>
<div class="tags">
<div class="examples">
<p class="tag_title">Examples:</p>
<pre class="example code"><code><span class='id identifier rubyid_paths'>paths</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='lbracket'>[</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>2</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='int'>3</span><span class='comma'>,</span> <span class='int'>4</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='int'>5</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='comment'>#=&gt;
</span> <span class='comment'># [[1, 3, 5],
</span> <span class='comment'># [2, 3, 5],
</span> <span class='comment'># [1, 4, 5],
</span> <span class='comment'># [2, 4, 5]]</span></code></pre>
</div>
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>arrs</span>
<span class='type'>(<tt>Array&lt;Array&gt;</tt>)</span>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Array&lt;Arrays&gt;</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
274
275
276
277
278</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 274</span>
<span class='kw'>def</span> <span class='id identifier rubyid_paths'>paths</span><span class='lparen'>(</span><span class='id identifier rubyid_arrs'>arrs</span><span class='rparen'>)</span>
<span class='id identifier rubyid_arrs'>arrs</span><span class='period'>.</span><span class='id identifier rubyid_inject'>inject</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_paths'>paths</span><span class='comma'>,</span> <span class='id identifier rubyid_arr'>arr</span><span class='op'>|</span>
<span class='id identifier rubyid_arr'>arr</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_e'>e</span><span class='op'>|</span> <span class='id identifier rubyid_paths'>paths</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_path'>path</span><span class='op'>|</span> <span class='id identifier rubyid_path'>path</span> <span class='op'>+</span> <span class='lbracket'>[</span><span class='id identifier rubyid_e'>e</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='lparen'>(</span><span class='int'>1</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="powerset-instance_method">
#<strong>powerset</strong>(arr) &#x21d2; <tt>Set&lt;Set&gt;</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Computes the powerset of the given array. This is the set of all subsets of
the array.</p>
</div>
</div>
<div class="tags">
<div class="examples">
<p class="tag_title">Examples:</p>
<pre class="example code"><code><span class='id identifier rubyid_powerset'>powerset</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>2</span><span class='comma'>,</span> <span class='int'>3</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='comment'>#=&gt;
</span> <span class='const'>Set</span><span class='lbracket'>[</span><span class='const'>Set</span><span class='lbracket'>[</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='const'>Set</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='const'>Set</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='const'>Set</span><span class='lbracket'>[</span><span class='int'>3</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='const'>Set</span><span class='lbracket'>[</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>2</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='const'>Set</span><span class='lbracket'>[</span><span class='int'>2</span><span class='comma'>,</span> <span class='int'>3</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='const'>Set</span><span class='lbracket'>[</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>3</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='const'>Set</span><span class='lbracket'>[</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>2</span><span class='comma'>,</span> <span class='int'>3</span><span class='rbracket'>]</span><span class='rbracket'>]</span></code></pre>
</div>
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>arr</span>
<span class='type'>(<tt>Enumerable</tt>)</span>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Set&lt;Set&gt;</tt>)</span>
&mdash;
<div class='inline'>
<p>The subsets of `arr`</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
110
111
112
113
114
115
116
117
118
119</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 110</span>
<span class='kw'>def</span> <span class='id identifier rubyid_powerset'>powerset</span><span class='lparen'>(</span><span class='id identifier rubyid_arr'>arr</span><span class='rparen'>)</span>
<span class='id identifier rubyid_arr'>arr</span><span class='period'>.</span><span class='id identifier rubyid_inject'>inject</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='const'>Set</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_set'>to_set</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_powerset'>powerset</span><span class='comma'>,</span> <span class='id identifier rubyid_el'>el</span><span class='op'>|</span>
<span class='id identifier rubyid_new_powerset'>new_powerset</span> <span class='op'>=</span> <span class='const'>Set</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
<span class='id identifier rubyid_powerset'>powerset</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_subset'>subset</span><span class='op'>|</span>
<span class='id identifier rubyid_new_powerset'>new_powerset</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_subset'>subset</span>
<span class='id identifier rubyid_new_powerset'>new_powerset</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_subset'>subset</span> <span class='op'>+</span> <span class='lbracket'>[</span><span class='id identifier rubyid_el'>el</span><span class='rbracket'>]</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_new_powerset'>new_powerset</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="rails_env-instance_method">
#<strong>rails_env</strong> &#x21d2; <tt>String</tt><sup>?</sup>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the environment of the Rails application, if this is running in a
Rails context. Returns `nil` if no such environment is defined.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>String</tt>, <tt>nil</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
497
498
499
500
501</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 497</span>
<span class='kw'>def</span> <span class='id identifier rubyid_rails_env'>rails_env</span>
<span class='kw'>return</span> <span class='op'>::</span><span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_env'>env</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='const'>RAILS_ENV</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='const'>RAILS_ENV</span><span class='rparen'>)</span>
<span class='kw'>nil</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="rails_root-instance_method">
#<strong>rails_root</strong> &#x21d2; <tt>String</tt><sup>?</sup>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the root of the Rails application, if this is running in a Rails
context. Returns `nil` if no such root is defined.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>String</tt>, <tt>nil</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
483
484
485
486
487
488
489
490</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 483</span>
<span class='kw'>def</span> <span class='id identifier rubyid_rails_root'>rails_root</span>
<span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_root'>root</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='op'>::</span><span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_root'>root</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='kw'>if</span> <span class='op'>::</span><span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_root'>root</span>
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ERROR: Rails.root is nil!</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span>
<span class='kw'>return</span> <span class='const'>RAILS_ROOT</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='const'>RAILS_ROOT</span><span class='rparen'>)</span>
<span class='kw'>nil</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="rbx?-instance_method">
#<strong>rbx?</strong> &#x21d2; <tt>Boolean</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Whether or not this is running on Rubinius.</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">
563
564
565
566</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 563</span>
<span class='kw'>def</span> <span class='id identifier rubyid_rbx?'>rbx?</span>
<span class='kw'>return</span> <span class='ivar'>@rbx</span> <span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='ivar'>@rbx</span><span class='rparen'>)</span>
<span class='ivar'>@rbx</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="#RUBY_ENGINE-constant" title="Sass::Util::RUBY_ENGINE (constant)">RUBY_ENGINE</a></span></span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>rbx</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="realpath-instance_method">
#<strong>realpath</strong>(path) &#x21d2; <tt>Pathname</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns `path` with all symlinks resolved.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>path</span>
<span class='type'>(<tt>String</tt>, <tt>Pathname</tt>)</span>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Pathname</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 624</span>
<span class='kw'>def</span> <span class='id identifier rubyid_realpath'>realpath</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
<span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Pathname</span><span class='rparen'>)</span>
<span class='comment'># Explicitly DON&#39;T run #pathname here. We don&#39;t want to convert
</span> <span class='comment'># to Windows directory separators because we&#39;re comparing these
</span> <span class='comment'># against the paths returned by Listen, which use forward
</span> <span class='comment'># slashes everywhere.
</span> <span class='kw'>begin</span>
<span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_realpath'>realpath</span>
<span class='kw'>rescue</span> <span class='const'>SystemCallError</span>
<span class='comment'># If [path] doesn&#39;t actually exist, don&#39;t bail, just
</span> <span class='comment'># return the original.
</span> <span class='id identifier rubyid_path'>path</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="relative_path_from-instance_method">
#<strong>relative_path_from</strong>(path, from) &#x21d2; <tt>Pathname?</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns `path` relative to `from`.</p>
<p>This is like `Pathname#relative_path_from` except it accepts both strings
and pathnames, it handles Windows path separators correctly, and it throws
an error rather than crashing if the paths use different encodings (<a
href="https://github.com/ruby/ruby/pull/713">github.com/ruby/ruby/pull/713</a>).</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>path</span>
<span class='type'>(<tt>String</tt>, <tt>Pathname</tt>)</span>
</li>
<li>
<span class='name'>from</span>
<span class='type'>(<tt>String</tt>, <tt>Pathname</tt>)</span>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Pathname?</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
650
651
652
653
654
655
656
657
658
659
660</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 650</span>
<span class='kw'>def</span> <span class='id identifier rubyid_relative_path_from'>relative_path_from</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_from'>from</span><span class='rparen'>)</span>
<span class='id identifier rubyid_pathname'>pathname</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_relative_path_from'>relative_path_from</span><span class='lparen'>(</span><span class='id identifier rubyid_pathname'>pathname</span><span class='lparen'>(</span><span class='id identifier rubyid_from'>from</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='kw'>rescue</span> <span class='const'>NoMethodError</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
<span class='id identifier rubyid_raise'>raise</span> <span class='id identifier rubyid_e'>e</span> <span class='kw'>unless</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='symbol'>:zero?</span>
<span class='comment'># Work around https://github.com/ruby/ruby/pull/713.
</span> <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
<span class='id identifier rubyid_from'>from</span> <span class='op'>=</span> <span class='id identifier rubyid_from'>from</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Incompatible path encodings: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'> is </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_encoding'>encoding</span><span class='embexpr_end'>}</span><span class='tstring_content'>, </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span>
<span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_from'>from</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'> is </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_from'>from</span><span class='period'>.</span><span class='id identifier rubyid_encoding'>encoding</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="replace_subseq-instance_method">
#<strong>replace_subseq</strong>(arr, subseq, replacement) &#x21d2; <tt>Array</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Non-destructively replaces all occurrences of a subsequence in an array
with another subsequence.</p>
</div>
</div>
<div class="tags">
<div class="examples">
<p class="tag_title">Examples:</p>
<pre class="example code"><code><span class='id identifier rubyid_replace_subseq'>replace_subseq</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>2</span><span class='comma'>,</span> <span class='int'>3</span><span class='comma'>,</span> <span class='int'>4</span><span class='comma'>,</span> <span class='int'>5</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='int'>2</span><span class='comma'>,</span> <span class='int'>3</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='symbol'>:a</span><span class='comma'>,</span> <span class='symbol'>:b</span><span class='rbracket'>]</span><span class='rparen'>)</span>
<span class='comment'>#=&gt; [1, :a, :b, 4, 5]</span></code></pre>
</div>
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>arr</span>
<span class='type'>(<tt>Array</tt>)</span>
&mdash;
<div class='inline'>
<p>The array whose subsequences will be replaced.</p>
</div>
</li>
<li>
<span class='name'>subseq</span>
<span class='type'>(<tt>Array</tt>)</span>
&mdash;
<div class='inline'>
<p>The subsequence to find and replace.</p>
</div>
</li>
<li>
<span class='name'>replacement</span>
<span class='type'>(<tt>Array</tt>)</span>
&mdash;
<div class='inline'>
<p>The sequence that `subseq` will be replaced with.</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Array</tt>)</span>
&mdash;
<div class='inline'>
<p>`arr` with `subseq` replaced with `replacement`.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 185</span>
<span class='kw'>def</span> <span class='id identifier rubyid_replace_subseq'>replace_subseq</span><span class='lparen'>(</span><span class='id identifier rubyid_arr'>arr</span><span class='comma'>,</span> <span class='id identifier rubyid_subseq'>subseq</span><span class='comma'>,</span> <span class='id identifier rubyid_replacement'>replacement</span><span class='rparen'>)</span>
<span class='id identifier rubyid_new'>new</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_matched'>matched</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_i'>i</span> <span class='op'>=</span> <span class='int'>0</span>
<span class='id identifier rubyid_arr'>arr</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_elem'>elem</span><span class='op'>|</span>
<span class='kw'>if</span> <span class='id identifier rubyid_elem'>elem</span> <span class='op'>!=</span> <span class='id identifier rubyid_subseq'>subseq</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_matched'>matched</span><span class='rparen'>)</span>
<span class='id identifier rubyid_matched'>matched</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_i'>i</span> <span class='op'>=</span> <span class='int'>0</span>
<span class='id identifier rubyid_new'>new</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_elem'>elem</span>
<span class='kw'>next</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='id identifier rubyid_i'>i</span> <span class='op'>==</span> <span class='id identifier rubyid_subseq'>subseq</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_matched'>matched</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_i'>i</span> <span class='op'>=</span> <span class='int'>0</span>
<span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_replacement'>replacement</span><span class='rparen'>)</span>
<span class='kw'>else</span>
<span class='id identifier rubyid_matched'>matched</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_elem'>elem</span>
<span class='id identifier rubyid_i'>i</span> <span class='op'>+=</span> <span class='int'>1</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_matched'>matched</span><span class='rparen'>)</span>
<span class='id identifier rubyid_new'>new</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="restrict-instance_method">
#<strong>restrict</strong>(value, range) &#x21d2; <tt>Numeric</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Restricts a number to falling within a given range. Returns the number if
it falls within the range, or the closest value in the range if it
doesn&#39;t.</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>
</li>
<li>
<span class='name'>range</span>
<span class='type'>(<tt>Range&lt;Numeric&gt;</tt>)</span>
</li>
</ul>
<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">
128
129
130</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 128</span>
<span class='kw'>def</span> <span class='id identifier rubyid_restrict'>restrict</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_range'>range</span><span class='rparen'>)</span>
<span class='lbracket'>[</span><span class='lbracket'>[</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_range'>range</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_max'>max</span><span class='comma'>,</span> <span class='id identifier rubyid_range'>range</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_min'>min</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="retry_on_windows-instance_method">
#<strong>retry_on_windows</strong> { ... } &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Retries a filesystem operation if it fails on Windows. Windows has weird
and flaky locking rules that can cause operations to fail.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Yields:</p>
<ul class="yield">
<li>
<span class='type'></span>
<div class='inline'><dl class="rdoc-list label-list"><dt>
<dd>
<p>The filesystem operation.</p>
</dd></dl>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
680
681
682
683
684
685
686
687
688
689</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 680</span>
<span class='kw'>def</span> <span class='id identifier rubyid_retry_on_windows'>retry_on_windows</span>
<span class='kw'>return</span> <span class='kw'>yield</span> <span class='kw'>unless</span> <span class='id identifier rubyid_windows?'>windows?</span>
<span class='kw'>begin</span>
<span class='kw'>yield</span>
<span class='kw'>rescue</span> <span class='const'>SystemCallError</span>
<span class='id identifier rubyid_sleep'>sleep</span> <span class='float'>0.1</span>
<span class='kw'>yield</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="round-instance_method">
#<strong>round</strong>(value) &#x21d2; <tt>Numeric</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Like [Fixnum.round], but leaves rooms for slight floating-point
differences.</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>
</li>
</ul>
<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">
137
138
139
140
141
142
143
144
145
146
147</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 137</span>
<span class='kw'>def</span> <span class='id identifier rubyid_round'>round</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
<span class='comment'># If the number is within epsilon of X.5, round up (or down for negative
</span> <span class='comment'># numbers).
</span> <span class='id identifier rubyid_mod'>mod</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='op'>%</span> <span class='int'>1</span>
<span class='id identifier rubyid_mod_is_half'>mod_is_half</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_mod'>mod</span> <span class='op'>-</span> <span class='float'>0.5</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_abs'>abs</span> <span class='op'>&lt;</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="Script/Value.html" title="Sass::Script::Value (module)">Value</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Script/Value/Number.html" title="Sass::Script::Value::Number (class)">Number</a></span></span><span class='period'>.</span><span class='id identifier rubyid_epsilon'><span class='object_link'><a href="Script/Value/Number.html#epsilon-class_method" title="Sass::Script::Value::Number.epsilon (method)">epsilon</a></span></span>
<span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span> <span class='op'>&gt;</span> <span class='int'>0</span>
<span class='op'>!</span><span class='id identifier rubyid_mod_is_half'>mod_is_half</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_mod'>mod</span> <span class='op'>&lt;</span> <span class='float'>0.5</span> <span class='op'>?</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_floor'>floor</span> <span class='op'>:</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_ceil'>ceil</span>
<span class='kw'>else</span>
<span class='id identifier rubyid_mod_is_half'>mod_is_half</span> <span class='op'>||</span> <span class='id identifier rubyid_mod'>mod</span> <span class='op'>&lt;</span> <span class='float'>0.5</span> <span class='op'>?</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_floor'>floor</span> <span class='op'>:</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_ceil'>ceil</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="ruby2_4?-instance_method">
#<strong>ruby2_4?</strong> &#x21d2; <tt>Boolean</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Whether or not this is running under Ruby 2.4 or higher.</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">
715
716
717
718
719
720
721
722
723</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 715</span>
<span class='kw'>def</span> <span class='id identifier rubyid_ruby2_4?'>ruby2_4?</span>
<span class='kw'>return</span> <span class='ivar'>@ruby2_4</span> <span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='ivar'>@ruby2_4</span><span class='rparen'>)</span>
<span class='ivar'>@ruby2_4</span> <span class='op'>=</span>
<span class='kw'>if</span> <span class='const'><span class='object_link'><a href="#RUBY_VERSION_COMPONENTS-constant" title="Sass::Util::RUBY_VERSION_COMPONENTS (constant)">RUBY_VERSION_COMPONENTS</a></span></span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='int'>2</span>
<span class='const'><span class='object_link'><a href="#RUBY_VERSION_COMPONENTS-constant" title="Sass::Util::RUBY_VERSION_COMPONENTS (constant)">RUBY_VERSION_COMPONENTS</a></span></span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='op'>&gt;=</span> <span class='int'>4</span>
<span class='kw'>else</span>
<span class='const'><span class='object_link'><a href="#RUBY_VERSION_COMPONENTS-constant" title="Sass::Util::RUBY_VERSION_COMPONENTS (constant)">RUBY_VERSION_COMPONENTS</a></span></span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span> <span class='op'>&gt;</span> <span class='int'>2</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="sass_warn-instance_method">
#<strong>sass_warn</strong>(msg) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>The same as `Kernel#warn`, but is silenced by <span class='object_link'><a href="#silence_sass_warnings-instance_method" title="Sass::Util#silence_sass_warnings (method)">#silence_sass_warnings</a></span>.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>msg</span>
<span class='type'>(<tt>String</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
472
473
474</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 472</span>
<span class='kw'>def</span> <span class='id identifier rubyid_sass_warn'>sass_warn</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</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='period'>.</span><span class='id identifier rubyid_logger'><span class='object_link'><a href="../Sass.html#logger-class_method" title="Sass.logger (method)">logger</a></span></span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_msg'>msg</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="scope-instance_method">
#<strong>scope</strong>(file) &#x21d2; <tt>String</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the path of a file relative to the Sass root directory.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>file</span>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>The filename relative to the Sass root</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>The filename relative to the the working directory</p>
</div>
</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/util.rb', line 34</span>
<span class='kw'>def</span> <span class='id identifier rubyid_scope'>scope</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span>
<span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</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="../Sass.html#ROOT_DIR-constant" title="Sass::ROOT_DIR (constant)">ROOT_DIR</a></span></span><span class='comma'>,</span> <span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="silence_sass_warnings-instance_method">
#<strong>silence_sass_warnings</strong> { ... } &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Silences all Sass warnings within a block.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Yields:</p>
<ul class="yield">
<li>
<span class='type'></span>
<div class='inline'>
<p>A block in which no Sass warnings will be printed</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
462
463
464
465
466
467</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 462</span>
<span class='kw'>def</span> <span class='id identifier rubyid_silence_sass_warnings'>silence_sass_warnings</span>
<span class='id identifier rubyid_old_level'>old_level</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="../Sass.html" title="Sass (module)">Sass</a></span></span><span class='period'>.</span><span class='id identifier rubyid_logger'><span class='object_link'><a href="../Sass.html#logger-class_method" title="Sass.logger (method)">logger</a></span></span><span class='period'>.</span><span class='id identifier rubyid_log_level'>log_level</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Sass.html" title="Sass (module)">Sass</a></span></span><span class='period'>.</span><span class='id identifier rubyid_logger'><span class='object_link'><a href="../Sass.html#logger-class_method" title="Sass.logger (method)">logger</a></span></span><span class='period'>.</span><span class='id identifier rubyid_log_level'>log_level</span><span class='comma'>,</span> <span class='symbol'>:error</span>
<span class='kw'>yield</span>
<span class='kw'>ensure</span>
<span class='const'><span class='object_link'><a href="../Sass.html" title="Sass (module)">Sass</a></span></span><span class='period'>.</span><span class='id identifier rubyid_logger'><span class='object_link'><a href="../Sass.html#logger-class_method" title="Sass.logger (method)">logger</a></span></span><span class='period'>.</span><span class='id identifier rubyid_log_level'>log_level</span> <span class='op'>=</span> <span class='id identifier rubyid_old_level'>old_level</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="slice_by-instance_method">
#<strong>slice_by</strong>(enum) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
221
222
223
224
225
226
227
228
229
230
231
232</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 221</span>
<span class='kw'>def</span> <span class='id identifier rubyid_slice_by'>slice_by</span><span class='lparen'>(</span><span class='id identifier rubyid_enum'>enum</span><span class='rparen'>)</span>
<span class='id identifier rubyid_results'>results</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_enum'>enum</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
<span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='kw'>yield</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_results'>results</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_results'>results</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='op'>==</span> <span class='id identifier rubyid_key'>key</span>
<span class='id identifier rubyid_results'>results</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_value'>value</span>
<span class='kw'>else</span>
<span class='id identifier rubyid_results'>results</span> <span class='op'>&lt;&lt;</span> <span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_value'>value</span><span class='rbracket'>]</span><span class='rbracket'>]</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_results'>results</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="sourcemap_name-instance_method">
#<strong>sourcemap_name</strong>(css) &#x21d2; <tt>String</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Builds a sourcemap file name given the generated CSS file name.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>css</span>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>The generated CSS file name.</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>The source map file name.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
883
884
885</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 883</span>
<span class='kw'>def</span> <span class='id identifier rubyid_sourcemap_name'>sourcemap_name</span><span class='lparen'>(</span><span class='id identifier rubyid_css'>css</span><span class='rparen'>)</span>
<span class='id identifier rubyid_css'>css</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.map</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="strip_string_array-instance_method">
#<strong>strip_string_array</strong>(arr) &#x21d2; <tt>Array</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Destructively strips whitespace from the beginning and end of the first and
last elements, respectively, in the array (if those elements are strings).</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>arr</span>
<span class='type'>(<tt>Array</tt>)</span>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Array</tt>)</span>
&mdash;
<div class='inline'>
<p>`arr`</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
257
258
259
260
261</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 257</span>
<span class='kw'>def</span> <span class='id identifier rubyid_strip_string_array'>strip_string_array</span><span class='lparen'>(</span><span class='id identifier rubyid_arr'>arr</span><span class='rparen'>)</span>
<span class='id identifier rubyid_arr'>arr</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_lstrip!'>lstrip!</span> <span class='kw'>if</span> <span class='id identifier rubyid_arr'>arr</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'>String</span><span class='rparen'>)</span>
<span class='id identifier rubyid_arr'>arr</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span><span class='period'>.</span><span class='id identifier rubyid_rstrip!'>rstrip!</span> <span class='kw'>if</span> <span class='id identifier rubyid_arr'>arr</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'>String</span><span class='rparen'>)</span>
<span class='id identifier rubyid_arr'>arr</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="subsequence?-instance_method">
#<strong>subsequence?</strong>(seq1, seq2) &#x21d2; <tt>Boolean</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns whether or not `seq1` is a subsequence of `seq2`. That is, whether
or not `seq2` contains every element in `seq1` in the same order (and
possibly more elements besides).</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>seq1</span>
<span class='type'>(<tt>Array</tt>)</span>
</li>
<li>
<span class='name'>seq2</span>
<span class='type'>(<tt>Array</tt>)</span>
</li>
</ul>
<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">
376
377
378
379
380
381
382
383
384</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 376</span>
<span class='kw'>def</span> <span class='id identifier rubyid_subsequence?'>subsequence?</span><span class='lparen'>(</span><span class='id identifier rubyid_seq1'>seq1</span><span class='comma'>,</span> <span class='id identifier rubyid_seq2'>seq2</span><span class='rparen'>)</span>
<span class='id identifier rubyid_i'>i</span> <span class='op'>=</span> <span class='id identifier rubyid_j'>j</span> <span class='op'>=</span> <span class='int'>0</span>
<span class='id identifier rubyid_loop'>loop</span> <span class='kw'>do</span>
<span class='kw'>return</span> <span class='kw'>true</span> <span class='kw'>if</span> <span class='id identifier rubyid_i'>i</span> <span class='op'>==</span> <span class='id identifier rubyid_seq1'>seq1</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span>
<span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>if</span> <span class='id identifier rubyid_j'>j</span> <span class='op'>==</span> <span class='id identifier rubyid_seq2'>seq2</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span>
<span class='id identifier rubyid_i'>i</span> <span class='op'>+=</span> <span class='int'>1</span> <span class='kw'>if</span> <span class='id identifier rubyid_seq1'>seq1</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='id identifier rubyid_seq2'>seq2</span><span class='lbracket'>[</span><span class='id identifier rubyid_j'>j</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_j'>j</span> <span class='op'>+=</span> <span class='int'>1</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="substitute-instance_method">
#<strong>substitute</strong>(ary, from, to) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Substitutes a sub-array of one array with another sub-array.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>ary</span>
<span class='type'>(<tt>Array</tt>)</span>
&mdash;
<div class='inline'>
<p>The array in which to make the substitution</p>
</div>
</li>
<li>
<span class='name'>from</span>
<span class='type'>(<tt>Array</tt>)</span>
&mdash;
<div class='inline'>
<p>The sequence of elements to replace with `to`</p>
</div>
</li>
<li>
<span class='name'>to</span>
<span class='type'>(<tt>Array</tt>)</span>
&mdash;
<div class='inline'>
<p>The sequence of elements to replace `from` with</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
239
240
241
242
243
244
245
246
247
248
249</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 239</span>
<span class='kw'>def</span> <span class='id identifier rubyid_substitute'>substitute</span><span class='lparen'>(</span><span class='id identifier rubyid_ary'>ary</span><span class='comma'>,</span> <span class='id identifier rubyid_from'>from</span><span class='comma'>,</span> <span class='id identifier rubyid_to'>to</span><span class='rparen'>)</span>
<span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='id identifier rubyid_ary'>ary</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span>
<span class='id identifier rubyid_i'>i</span> <span class='op'>=</span> <span class='int'>0</span>
<span class='kw'>while</span> <span class='id identifier rubyid_i'>i</span> <span class='op'>&lt;</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span>
<span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='op'>...</span><span class='id identifier rubyid_i'>i</span> <span class='op'>+</span> <span class='id identifier rubyid_from'>from</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='id identifier rubyid_from'>from</span>
<span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='op'>...</span><span class='id identifier rubyid_i'>i</span> <span class='op'>+</span> <span class='id identifier rubyid_from'>from</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_to'>to</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_i'>i</span> <span class='op'>+=</span> <span class='int'>1</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_res'>res</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="undefined_conversion_error_char-instance_method">
#<strong>undefined_conversion_error_char</strong>(e) &#x21d2; <tt>String</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns a string description of the character that caused an
`Encoding::UndefinedConversionError`.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>e</span>
<span class='type'>(<tt>Encoding::UndefinedConversionError</tt>)</span>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>String</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
340
341
342
343
344
345
346
347</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 340</span>
<span class='kw'>def</span> <span class='id identifier rubyid_undefined_conversion_error_char'>undefined_conversion_error_char</span><span class='lparen'>(</span><span class='id identifier rubyid_e'>e</span><span class='rparen'>)</span>
<span class='comment'># Rubinius (as of 2.0.0.rc1) pre-quotes the error character.
</span> <span class='kw'>return</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_error_char'>error_char</span> <span class='kw'>if</span> <span class='id identifier rubyid_rbx?'>rbx?</span>
<span class='comment'># JRuby (as of 1.7.2) doesn&#39;t have an error_char field on
</span> <span class='comment'># Encoding::UndefinedConversionError.
</span> <span class='kw'>return</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_error_char'>error_char</span><span class='period'>.</span><span class='id identifier rubyid_dump'>dump</span> <span class='kw'>unless</span> <span class='id identifier rubyid_jruby?'>jruby?</span>
<span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='lbracket'>[</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^&quot;[^&quot;]+&quot;</span><span class='regexp_end'>/</span></span><span class='rbracket'>]</span> <span class='comment'># &quot;
</span><span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="upcase-instance_method">
#<strong>upcase</strong>(string) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Like `String.upcase`, but only ever upcases ASCII letters.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
299
300
301
302</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 299</span>
<span class='kw'>def</span> <span class='id identifier rubyid_upcase'>upcase</span><span class='lparen'>(</span><span class='id identifier rubyid_string'>string</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='id identifier rubyid_string'>string</span><span class='period'>.</span><span class='id identifier rubyid_upcase'>upcase</span> <span class='kw'>unless</span> <span class='id identifier rubyid_ruby2_4?'>ruby2_4?</span>
<span class='id identifier rubyid_string'>string</span><span class='period'>.</span><span class='id identifier rubyid_upcase'>upcase</span><span class='lparen'>(</span><span class='symbol'>:ascii</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="version_geq-instance_method">
#<strong>version_geq</strong>(v1, v2) &#x21d2; <tt>Boolean</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns whether one version string represents the same or a more recent
version than another.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>v1</span>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>A version string.</p>
</div>
</li>
<li>
<span class='name'>v2</span>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>Another version string.</p>
</div>
</li>
</ul>
<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">
436
437
438</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 436</span>
<span class='kw'>def</span> <span class='id identifier rubyid_version_geq'>version_geq</span><span class='lparen'>(</span><span class='id identifier rubyid_v1'>v1</span><span class='comma'>,</span> <span class='id identifier rubyid_v2'>v2</span><span class='rparen'>)</span>
<span class='id identifier rubyid_version_gt'>version_gt</span><span class='lparen'>(</span><span class='id identifier rubyid_v1'>v1</span><span class='comma'>,</span> <span class='id identifier rubyid_v2'>v2</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='op'>!</span><span class='id identifier rubyid_version_gt'>version_gt</span><span class='lparen'>(</span><span class='id identifier rubyid_v2'>v2</span><span class='comma'>,</span> <span class='id identifier rubyid_v1'>v1</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="version_gt-instance_method">
#<strong>version_gt</strong>(v1, v2) &#x21d2; <tt>Boolean</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns whether one version string represents a more recent version than
another.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>v1</span>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>A version string.</p>
</div>
</li>
<li>
<span class='name'>v2</span>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>Another version string.</p>
</div>
</li>
</ul>
<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">
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 407</span>
<span class='kw'>def</span> <span class='id identifier rubyid_version_gt'>version_gt</span><span class='lparen'>(</span><span class='id identifier rubyid_v1'>v1</span><span class='comma'>,</span> <span class='id identifier rubyid_v2'>v2</span><span class='rparen'>)</span>
<span class='comment'># Construct an array to make sure the shorter version is padded with nil
</span> <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='id identifier rubyid_v1'>v1</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='comma'>,</span> <span class='id identifier rubyid_v2'>v2</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_max'>max</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_zip'>zip</span><span class='lparen'>(</span><span class='id identifier rubyid_v1'>v1</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_v2'>v2</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid__'>_</span><span class='comma'>,</span> <span class='id identifier rubyid_p1'>p1</span><span class='comma'>,</span> <span class='id identifier rubyid_p2'>p2</span><span class='op'>|</span>
<span class='id identifier rubyid_p1'>p1</span> <span class='op'>||=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0</span><span class='tstring_end'>&quot;</span></span>
<span class='id identifier rubyid_p2'>p2</span> <span class='op'>||=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0</span><span class='tstring_end'>&quot;</span></span>
<span class='id identifier rubyid_release1'>release1</span> <span class='op'>=</span> <span class='id identifier rubyid_p1'>p1</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^[0-9]+$</span><span class='regexp_end'>/</span></span>
<span class='id identifier rubyid_release2'>release2</span> <span class='op'>=</span> <span class='id identifier rubyid_p2'>p2</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^[0-9]+$</span><span class='regexp_end'>/</span></span>
<span class='kw'>if</span> <span class='id identifier rubyid_release1'>release1</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_release2'>release2</span>
<span class='comment'># Integer comparison if both are full releases
</span> <span class='id identifier rubyid_p1'>p1</span><span class='comma'>,</span> <span class='id identifier rubyid_p2'>p2</span> <span class='op'>=</span> <span class='id identifier rubyid_p1'>p1</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='comma'>,</span> <span class='id identifier rubyid_p2'>p2</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
<span class='kw'>next</span> <span class='kw'>if</span> <span class='id identifier rubyid_p1'>p1</span> <span class='op'>==</span> <span class='id identifier rubyid_p2'>p2</span>
<span class='kw'>return</span> <span class='id identifier rubyid_p1'>p1</span> <span class='op'>&gt;</span> <span class='id identifier rubyid_p2'>p2</span>
<span class='kw'>elsif</span> <span class='op'>!</span><span class='id identifier rubyid_release1'>release1</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_release2'>release2</span>
<span class='comment'># String comparison if both are prereleases
</span> <span class='kw'>next</span> <span class='kw'>if</span> <span class='id identifier rubyid_p1'>p1</span> <span class='op'>==</span> <span class='id identifier rubyid_p2'>p2</span>
<span class='kw'>return</span> <span class='id identifier rubyid_p1'>p1</span> <span class='op'>&gt;</span> <span class='id identifier rubyid_p2'>p2</span>
<span class='kw'>else</span>
<span class='comment'># If only one is a release, that one is newer
</span> <span class='kw'>return</span> <span class='id identifier rubyid_release1'>release1</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="windows?-instance_method">
#<strong>windows?</strong> &#x21d2; <tt>Boolean</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Whether or not this is running on Windows.</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">
547
548
549
550</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 547</span>
<span class='kw'>def</span> <span class='id identifier rubyid_windows?'>windows?</span>
<span class='kw'>return</span> <span class='ivar'>@windows</span> <span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='ivar'>@windows</span><span class='rparen'>)</span>
<span class='ivar'>@windows</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='const'>RbConfig</span><span class='op'>::</span><span class='const'>CONFIG</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>host_os</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>mswin|windows|mingw</span><span class='regexp_end'>/i</span></span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="with_extracted_values-instance_method">
#<strong>with_extracted_values</strong>(arr) {|str| ... } &#x21d2; <tt>Array</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Allows modifications to be performed on the string form of an array
containing both strings and non-strings.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>arr</span>
<span class='type'>(<tt>Array</tt>)</span>
&mdash;
<div class='inline'>
<p>The array from which values are extracted.</p>
</div>
</li>
</ul>
<p class="tag_title">Yields:</p>
<ul class="yield">
<li>
<span class='type'>(<tt>str</tt>)</span>
&mdash;
<div class='inline'>
<p>A block in which string manipulation can be done to the array.</p>
</div>
</li>
</ul>
<p class="tag_title">Yield Parameters:</p>
<ul class="yieldparam">
<li>
<span class='name'>str</span>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>The string form of `arr`.</p>
</div>
</li>
</ul>
<p class="tag_title">Yield Returns:</p>
<ul class="yieldreturn">
<li>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>The modified string.</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Array</tt>)</span>
&mdash;
<div class='inline'>
<p>The modified, interpolated array.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
873
874
875
876
877</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util.rb', line 873</span>
<span class='kw'>def</span> <span class='id identifier rubyid_with_extracted_values'>with_extracted_values</span><span class='lparen'>(</span><span class='id identifier rubyid_arr'>arr</span><span class='rparen'>)</span>
<span class='id identifier rubyid_str'>str</span><span class='comma'>,</span> <span class='id identifier rubyid_vals'>vals</span> <span class='op'>=</span> <span class='id identifier rubyid_extract_values'>extract_values</span><span class='lparen'>(</span><span class='id identifier rubyid_arr'>arr</span><span class='rparen'>)</span>
<span class='id identifier rubyid_str'>str</span> <span class='op'>=</span> <span class='kw'>yield</span> <span class='id identifier rubyid_str'>str</span>
<span class='id identifier rubyid_inject_values'>inject_values</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='comma'>,</span> <span class='id identifier rubyid_vals'>vals</span><span class='rparen'>)</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>