File: C:/Ruby27-x64/share/doc/ruby/html/Bundler/Thor/Shell/HTML.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>class Bundler::Thor::Shell::HTML - RDoc Documentation</title>
<script type="text/javascript">
var rdoc_rel_prefix = "../../../";
var index_rel_prefix = "../../../";
</script>
<script src="../../../js/navigation.js" defer></script>
<script src="../../../js/search.js" defer></script>
<script src="../../../js/search_index.js" defer></script>
<script src="../../../js/searcher.js" defer></script>
<script src="../../../js/darkfish.js" defer></script>
<link href="../../../css/fonts.css" rel="stylesheet">
<link href="../../../css/rdoc.css" rel="stylesheet">
<body id="top" role="document" class="class">
<nav role="navigation">
<div id="project-navigation">
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
<h2>
<a href="../../../index.html" rel="home">Home</a>
</h2>
<div id="table-of-contents-navigation">
<a href="../../../table_of_contents.html#pages">Pages</a>
<a href="../../../table_of_contents.html#classes">Classes</a>
<a href="../../../table_of_contents.html#methods">Methods</a>
</div>
</div>
<div id="search-section" role="search" class="project-section initially-hidden">
<form action="#" method="get" accept-charset="utf-8">
<div id="search-field-wrapper">
<input id="search-field" role="combobox" aria-label="Search"
aria-autocomplete="list" aria-controls="search-results"
type="text" name="search" placeholder="Search" spellcheck="false"
title="Type to search, Up and Down to navigate, Enter to load">
</div>
<ul id="search-results" aria-label="Search Results"
aria-busy="false" aria-expanded="false"
aria-atomic="false" class="initially-hidden"></ul>
</form>
</div>
</div>
<div id="class-metadata">
<div id="parent-class-section" class="nav-section">
<h3>Parent</h3>
<p class="link"><a href="Basic.html">Bundler::Thor::Shell::Basic</a>
</div>
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
<h3>Methods</h3>
<ul class="link-list" role="directory">
<li ><a href="#method-i-ask">#ask</a>
<li ><a href="#method-i-can_display_colors-3F">#can_display_colors?</a>
<li ><a href="#method-i-set_color">#set_color</a>
</ul>
</div>
</div>
</nav>
<main role="main" aria-labelledby="class-Bundler::Thor::Shell::HTML">
<h1 id="class-Bundler::Thor::Shell::HTML" class="class">
class Bundler::Thor::Shell::HTML
</h1>
<section class="description">
<p>Inherit from <a href="Basic.html"><code>Bundler::Thor::Shell::Basic</code></a> and add <a href="HTML.html#method-i-set_color"><code>set_color</code></a> behavior. Check <a href="Basic.html"><code>Bundler::Thor::Shell::Basic</code></a> to see all available methods.</p>
</section>
<section id="5Buntitled-5D" class="documentation-section">
<section class="constants-list">
<header>
<h3>Constants</h3>
</header>
<dl>
<dt id="BLACK">BLACK
<dd><p><a href="../../../Set.html"><code>Set</code></a> the terminal's foreground <a href="HTML.html"><code>HTML</code></a> color to black.</p>
<dt id="BLUE">BLUE
<dd><p><a href="../../../Set.html"><code>Set</code></a> the terminal's foreground <a href="HTML.html"><code>HTML</code></a> color to blue.</p>
<dt id="BOLD">BOLD
<dd><p>The start of an <a href="HTML.html"><code>HTML</code></a> bold sequence.</p>
<dt id="CYAN">CYAN
<dd><p><a href="../../../Set.html"><code>Set</code></a> the terminal's foreground <a href="HTML.html"><code>HTML</code></a> color to cyan.</p>
<dt id="GREEN">GREEN
<dd><p><a href="../../../Set.html"><code>Set</code></a> the terminal's foreground <a href="HTML.html"><code>HTML</code></a> color to green.</p>
<dt id="MAGENTA">MAGENTA
<dd><p><a href="../../../Set.html"><code>Set</code></a> the terminal's foreground <a href="HTML.html"><code>HTML</code></a> color to magenta.</p>
<dt id="ON_BLACK">ON_BLACK
<dd><p><a href="../../../Set.html"><code>Set</code></a> the terminal's background <a href="HTML.html"><code>HTML</code></a> color to black.</p>
<dt id="ON_BLUE">ON_BLUE
<dd><p><a href="../../../Set.html"><code>Set</code></a> the terminal's background <a href="HTML.html"><code>HTML</code></a> color to blue.</p>
<dt id="ON_CYAN">ON_CYAN
<dd><p><a href="../../../Set.html"><code>Set</code></a> the terminal's background <a href="HTML.html"><code>HTML</code></a> color to cyan.</p>
<dt id="ON_GREEN">ON_GREEN
<dd><p><a href="../../../Set.html"><code>Set</code></a> the terminal's background <a href="HTML.html"><code>HTML</code></a> color to green.</p>
<dt id="ON_MAGENTA">ON_MAGENTA
<dd><p><a href="../../../Set.html"><code>Set</code></a> the terminal's background <a href="HTML.html"><code>HTML</code></a> color to magenta.</p>
<dt id="ON_RED">ON_RED
<dd><p><a href="../../../Set.html"><code>Set</code></a> the terminal's background <a href="HTML.html"><code>HTML</code></a> color to red.</p>
<dt id="ON_WHITE">ON_WHITE
<dd><p><a href="../../../Set.html"><code>Set</code></a> the terminal's background <a href="HTML.html"><code>HTML</code></a> color to white.</p>
<dt id="ON_YELLOW">ON_YELLOW
<dd><p><a href="../../../Set.html"><code>Set</code></a> the terminal's background <a href="HTML.html"><code>HTML</code></a> color to yellow.</p>
<dt id="RED">RED
<dd><p><a href="../../../Set.html"><code>Set</code></a> the terminal's foreground <a href="HTML.html"><code>HTML</code></a> color to red.</p>
<dt id="WHITE">WHITE
<dd><p><a href="../../../Set.html"><code>Set</code></a> the terminal's foreground <a href="HTML.html"><code>HTML</code></a> color to white.</p>
<dt id="YELLOW">YELLOW
<dd><p><a href="../../../Set.html"><code>Set</code></a> the terminal's foreground <a href="HTML.html"><code>HTML</code></a> color to yellow.</p>
</dl>
</section>
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
<header>
<h3>Public Instance Methods</h3>
</header>
<div id="method-i-ask" class="method-detail ">
<div class="method-heading">
<span class="method-name">ask</span><span
class="method-args">(statement, color = nil)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<p>Ask something to the user and receives a response.</p>
<h4 id="method-i-ask-label-Example">Example<span><a href="#method-i-ask-label-Example">¶</a> <a href="#top">↑</a></span></h4>
<p>ask(“What is your name?”)</p>
<p>TODO: Implement <a href="HTML.html#method-i-ask"><code>ask</code></a> for <a href="HTML.html"><code>Bundler::Thor::Shell::HTML</code></a></p>
<div class="method-source-code" id="ask-source">
<pre><span class="ruby-comment"># File lib/bundler/vendor/thor/lib/thor/shell/html.rb, line 70</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">ask</span>(<span class="ruby-identifier">statement</span>, <span class="ruby-identifier">color</span> = <span class="ruby-keyword">nil</span>)
<span class="ruby-identifier">raise</span> <span class="ruby-constant">NotImplementedError</span>, <span class="ruby-string">"Implement #ask for Bundler::Thor::Shell::HTML"</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div id="method-i-set_color" class="method-detail ">
<div class="method-heading">
<span class="method-name">set_color</span><span
class="method-args">(string, *colors)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<p><a href="../../../Set.html"><code>Set</code></a> color by using a string or one of the defined constants. If a third option is set to true, it also adds bold to the string. This is based on Highline implementation and it automatically appends CLEAR to the end of the returned <a href="../../../String.html"><code>String</code></a>.</p>
<div class="method-source-code" id="set_color-source">
<pre><span class="ruby-comment"># File lib/bundler/vendor/thor/lib/thor/shell/html.rb, line 51</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">set_color</span>(<span class="ruby-identifier">string</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">colors</span>)
<span class="ruby-keyword">if</span> <span class="ruby-identifier">colors</span>.<span class="ruby-identifier">all?</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">color</span><span class="ruby-operator">|</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Symbol</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>) }
<span class="ruby-identifier">html_colors</span> = <span class="ruby-identifier">colors</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">color</span><span class="ruby-operator">|</span> <span class="ruby-identifier">lookup_color</span>(<span class="ruby-identifier">color</span>) }
<span class="ruby-node">"<span style=\"#{html_colors.join('; ')};\">#{Bundler::Thor::Util.escape_html(string)}</span>"</span>
<span class="ruby-keyword">else</span>
<span class="ruby-identifier">color</span>, <span class="ruby-identifier">bold</span> = <span class="ruby-identifier">colors</span>
<span class="ruby-identifier">html_color</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">color</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">upcase</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Symbol</span>)
<span class="ruby-identifier">styles</span> = [<span class="ruby-identifier">html_color</span>]
<span class="ruby-identifier">styles</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">BOLD</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">bold</span>
<span class="ruby-node">"<span style=\"#{styles.join('; ')};\">#{Bundler::Thor::Util.escape_html(string)}</span>"</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
</section>
<section id="protected-instance-5Buntitled-5D-method-details" class="method-section">
<header>
<h3>Protected Instance Methods</h3>
</header>
<div id="method-i-can_display_colors-3F" class="method-detail ">
<div class="method-heading">
<span class="method-name">can_display_colors?</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="can_display_colors-3F-source">
<pre><span class="ruby-comment"># File lib/bundler/vendor/thor/lib/thor/shell/html.rb, line 76</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">can_display_colors?</span>
<span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
</section>
</section>
</main>
<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.1.1.
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
</footer>