na 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +8 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +35 -0
- data/README.rdoc +6 -0
- data/Rakefile +31 -0
- data/bin/na +285 -0
- data/html/App.html +105 -0
- data/html/NA/Action.html +299 -0
- data/html/NA/Color.html +373 -0
- data/html/NA.html +100 -0
- data/html/README_rdoc.html +328 -0
- data/html/String.html +368 -0
- data/html/created.rid +9 -0
- data/html/css/fonts.css +167 -0
- data/html/css/rdoc.css +639 -0
- data/html/fonts/Lato-Light.ttf +0 -0
- data/html/fonts/Lato-LightItalic.ttf +0 -0
- data/html/fonts/Lato-Regular.ttf +0 -0
- data/html/fonts/Lato-RegularItalic.ttf +0 -0
- data/html/fonts/SourceCodePro-Bold.ttf +0 -0
- data/html/fonts/SourceCodePro-Regular.ttf +0 -0
- data/html/images/add.png +0 -0
- data/html/images/arrow_up.png +0 -0
- data/html/images/brick.png +0 -0
- data/html/images/brick_link.png +0 -0
- data/html/images/bug.png +0 -0
- data/html/images/bullet_black.png +0 -0
- data/html/images/bullet_toggle_minus.png +0 -0
- data/html/images/bullet_toggle_plus.png +0 -0
- data/html/images/date.png +0 -0
- data/html/images/delete.png +0 -0
- data/html/images/find.png +0 -0
- data/html/images/loadingAnimation.gif +0 -0
- data/html/images/macFFBgHack.png +0 -0
- data/html/images/package.png +0 -0
- data/html/images/page_green.png +0 -0
- data/html/images/page_white_text.png +0 -0
- data/html/images/page_white_width.png +0 -0
- data/html/images/plugin.png +0 -0
- data/html/images/ruby.png +0 -0
- data/html/images/tag_blue.png +0 -0
- data/html/images/tag_green.png +0 -0
- data/html/images/transparent.png +0 -0
- data/html/images/wrench.png +0 -0
- data/html/images/wrench_orange.png +0 -0
- data/html/images/zoom.png +0 -0
- data/html/index.html +297 -0
- data/html/js/darkfish.js +84 -0
- data/html/js/navigation.js +105 -0
- data/html/js/navigation.js.gz +0 -0
- data/html/js/search.js +110 -0
- data/html/js/search_index.js +1 -0
- data/html/js/search_index.js.gz +0 -0
- data/html/js/searcher.js +229 -0
- data/html/js/searcher.js.gz +0 -0
- data/html/table_of_contents.html +237 -0
- data/lib/na/action.rb +65 -0
- data/lib/na/colors.rb +335 -0
- data/lib/na/next_action.rb +181 -0
- data/lib/na/string.rb +42 -0
- data/lib/na/version.rb +3 -0
- data/lib/na.rb +11 -0
- data/na.gemspec +26 -0
- data/na.rdoc +167 -0
- metadata +211 -0
data/html/String.html
ADDED
@@ -0,0 +1,368 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class String - Your application title</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "./";
|
11
|
+
var index_rel_prefix = "./";
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<script src="./js/navigation.js" defer></script>
|
15
|
+
<script src="./js/search.js" defer></script>
|
16
|
+
<script src="./js/search_index.js" defer></script>
|
17
|
+
<script src="./js/searcher.js" defer></script>
|
18
|
+
<script src="./js/darkfish.js" defer></script>
|
19
|
+
|
20
|
+
<link href="./css/fonts.css" rel="stylesheet">
|
21
|
+
<link href="./css/rdoc.css" rel="stylesheet">
|
22
|
+
|
23
|
+
|
24
|
+
<body id="top" role="document" class="class">
|
25
|
+
<nav role="navigation">
|
26
|
+
<div id="project-navigation">
|
27
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
28
|
+
<h2>
|
29
|
+
<a href="./index.html" rel="home">Home</a>
|
30
|
+
</h2>
|
31
|
+
|
32
|
+
<div id="table-of-contents-navigation">
|
33
|
+
<a href="./table_of_contents.html#pages">Pages</a>
|
34
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
35
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
40
|
+
<form action="#" method="get" accept-charset="utf-8">
|
41
|
+
<div id="search-field-wrapper">
|
42
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
43
|
+
aria-autocomplete="list" aria-controls="search-results"
|
44
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
45
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
46
|
+
</div>
|
47
|
+
|
48
|
+
<ul id="search-results" aria-label="Search Results"
|
49
|
+
aria-busy="false" aria-expanded="false"
|
50
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
51
|
+
</form>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
</div>
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
<div id="class-metadata">
|
59
|
+
|
60
|
+
|
61
|
+
<div id="parent-class-section" class="nav-section">
|
62
|
+
<h3>Parent</h3>
|
63
|
+
|
64
|
+
<p class="link">Object
|
65
|
+
</div>
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
<!-- Method Quickref -->
|
71
|
+
<div id="method-list-section" class="nav-section">
|
72
|
+
<h3>Methods</h3>
|
73
|
+
|
74
|
+
<ul class="link-list" role="directory">
|
75
|
+
<li ><a href="#method-i-highlight_tags">#highlight_tags</a>
|
76
|
+
<li ><a href="#method-i-indent_level">#indent_level</a>
|
77
|
+
<li ><a href="#method-i-last_color_code">#last_color_code</a>
|
78
|
+
<li ><a href="#method-i-matches">#matches</a>
|
79
|
+
<li ><a href="#method-i-matches_all">#matches_all</a>
|
80
|
+
<li ><a href="#method-i-matches_any">#matches_any</a>
|
81
|
+
<li ><a href="#method-i-normalize_color">#normalize_color</a>
|
82
|
+
<li ><a href="#method-i-validate_color">#validate_color</a>
|
83
|
+
</ul>
|
84
|
+
</div>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
</nav>
|
88
|
+
|
89
|
+
<main role="main" aria-labelledby="class-String">
|
90
|
+
<h1 id="class-String" class="class">
|
91
|
+
class String
|
92
|
+
</h1>
|
93
|
+
|
94
|
+
<section class="description">
|
95
|
+
|
96
|
+
<p>Template coloring</p>
|
97
|
+
|
98
|
+
</section>
|
99
|
+
|
100
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
107
|
+
<header>
|
108
|
+
<h3>Public Instance Methods</h3>
|
109
|
+
</header>
|
110
|
+
|
111
|
+
<div id="method-i-highlight_tags" class="method-detail ">
|
112
|
+
<div class="method-heading">
|
113
|
+
<span class="method-name">highlight_tags</span><span
|
114
|
+
class="method-args">(color: '{m}', value: '{y}', parens: '{m}', last_color: '{g}')</span>
|
115
|
+
<span class="method-click-advice">click to toggle source</span>
|
116
|
+
</div>
|
117
|
+
|
118
|
+
<div class="method-description">
|
119
|
+
<p>Colorize @tags with ANSI escapes</p>
|
120
|
+
|
121
|
+
<p>@param color [String] color (see #Color)</p>
|
122
|
+
|
123
|
+
<p>@return [String] string with @tags highlighted</p>
|
124
|
+
|
125
|
+
<div class="method-source-code" id="highlight_tags-source">
|
126
|
+
<pre><span class="ruby-comment"># File lib/na/string.rb, line 18</span>
|
127
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">highlight_tags</span>(<span class="ruby-value">color:</span> <span class="ruby-string">'{m}'</span>, <span class="ruby-value">value:</span> <span class="ruby-string">'{y}'</span>, <span class="ruby-value">parens:</span> <span class="ruby-string">'{m}'</span>, <span class="ruby-value">last_color:</span> <span class="ruby-string">'{g}'</span>)
|
128
|
+
<span class="ruby-identifier">tag_color</span> = <span class="ruby-constant">NA</span><span class="ruby-operator">::</span><span class="ruby-constant">Color</span>.<span class="ruby-identifier">template</span>(<span class="ruby-identifier">color</span>)
|
129
|
+
<span class="ruby-identifier">paren_color</span> = <span class="ruby-constant">NA</span><span class="ruby-operator">::</span><span class="ruby-constant">Color</span>.<span class="ruby-identifier">template</span>(<span class="ruby-identifier">parens</span>)
|
130
|
+
<span class="ruby-identifier">value_color</span> = <span class="ruby-constant">NA</span><span class="ruby-operator">::</span><span class="ruby-constant">Color</span>.<span class="ruby-identifier">template</span>(<span class="ruby-identifier">value</span>)
|
131
|
+
<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/(\s|m)(@[^ ("']+)(?:(\()(.*?)(\)))?/</span>, <span class="ruby-node">"\\1#{tag_color}\\2#{paren_color}\\3#{value_color}\\4#{paren_color}\\5#{last_color}"</span>)
|
132
|
+
<span class="ruby-keyword">end</span></pre>
|
133
|
+
</div>
|
134
|
+
</div>
|
135
|
+
|
136
|
+
|
137
|
+
</div>
|
138
|
+
|
139
|
+
<div id="method-i-indent_level" class="method-detail ">
|
140
|
+
<div class="method-heading">
|
141
|
+
<span class="method-name">indent_level</span><span
|
142
|
+
class="method-args">()</span>
|
143
|
+
<span class="method-click-advice">click to toggle source</span>
|
144
|
+
</div>
|
145
|
+
|
146
|
+
<div class="method-description">
|
147
|
+
|
148
|
+
|
149
|
+
<div class="method-source-code" id="indent_level-source">
|
150
|
+
<pre><span class="ruby-comment"># File lib/na/string.rb, line 4</span>
|
151
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">indent_level</span>
|
152
|
+
<span class="ruby-identifier">prefix</span> = <span class="ruby-identifier">match</span>(<span class="ruby-regexp">/(^[ \t]+)/</span>)
|
153
|
+
<span class="ruby-keyword">return</span> <span class="ruby-value">0</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">prefix</span>.<span class="ruby-identifier">nil?</span>
|
154
|
+
|
155
|
+
<span class="ruby-identifier">prefix</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/ /</span>, <span class="ruby-string">"\t"</span>).<span class="ruby-identifier">scan</span>(<span class="ruby-regexp">/\t/</span>).<span class="ruby-identifier">count</span>
|
156
|
+
<span class="ruby-keyword">end</span></pre>
|
157
|
+
</div>
|
158
|
+
</div>
|
159
|
+
|
160
|
+
|
161
|
+
</div>
|
162
|
+
|
163
|
+
<div id="method-i-last_color_code" class="method-detail ">
|
164
|
+
<div class="method-heading">
|
165
|
+
<span class="method-name">last_color_code</span><span
|
166
|
+
class="method-args">()</span>
|
167
|
+
<span class="method-click-advice">click to toggle source</span>
|
168
|
+
</div>
|
169
|
+
|
170
|
+
<div class="method-description">
|
171
|
+
<p>Get the calculated ANSI color at the end of the string</p>
|
172
|
+
|
173
|
+
<p>@return ANSI escape sequence to match color</p>
|
174
|
+
|
175
|
+
<div class="method-source-code" id="last_color_code-source">
|
176
|
+
<pre><span class="ruby-comment"># File lib/na/colors.rb, line 138</span>
|
177
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">last_color_code</span>
|
178
|
+
<span class="ruby-identifier">m</span> = <span class="ruby-identifier">scan</span>(<span class="ruby-constant">ESCAPE_REGEX</span>)
|
179
|
+
|
180
|
+
<span class="ruby-identifier">em</span> = [<span class="ruby-string">'0'</span>]
|
181
|
+
<span class="ruby-identifier">fg</span> = <span class="ruby-keyword">nil</span>
|
182
|
+
<span class="ruby-identifier">bg</span> = <span class="ruby-keyword">nil</span>
|
183
|
+
<span class="ruby-identifier">rgbf</span> = <span class="ruby-keyword">nil</span>
|
184
|
+
<span class="ruby-identifier">rgbb</span> = <span class="ruby-keyword">nil</span>
|
185
|
+
|
186
|
+
<span class="ruby-identifier">m</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span>
|
187
|
+
<span class="ruby-keyword">case</span> <span class="ruby-identifier">c</span>
|
188
|
+
<span class="ruby-keyword">when</span> <span class="ruby-string">'0'</span>
|
189
|
+
<span class="ruby-identifier">em</span> = [<span class="ruby-string">'0'</span>]
|
190
|
+
<span class="ruby-identifier">fg</span>, <span class="ruby-identifier">bg</span>, <span class="ruby-identifier">rgbf</span>, <span class="ruby-identifier">rgbb</span> = <span class="ruby-keyword">nil</span>
|
191
|
+
<span class="ruby-keyword">when</span> <span class="ruby-regexp">/^[34]8/</span>
|
192
|
+
<span class="ruby-keyword">case</span> <span class="ruby-identifier">c</span>
|
193
|
+
<span class="ruby-keyword">when</span> <span class="ruby-regexp">/^3/</span>
|
194
|
+
<span class="ruby-identifier">fg</span> = <span class="ruby-keyword">nil</span>
|
195
|
+
<span class="ruby-identifier">rgbf</span> = <span class="ruby-identifier">c</span>
|
196
|
+
<span class="ruby-keyword">when</span> <span class="ruby-regexp">/^4/</span>
|
197
|
+
<span class="ruby-identifier">bg</span> = <span class="ruby-keyword">nil</span>
|
198
|
+
<span class="ruby-identifier">rgbb</span> = <span class="ruby-identifier">c</span>
|
199
|
+
<span class="ruby-keyword">end</span>
|
200
|
+
<span class="ruby-keyword">else</span>
|
201
|
+
<span class="ruby-identifier">c</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/;/</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
202
|
+
<span class="ruby-identifier">x</span> = <span class="ruby-identifier">i</span>.<span class="ruby-identifier">to_i</span>
|
203
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">x</span> <span class="ruby-operator"><=</span> <span class="ruby-value">9</span>
|
204
|
+
<span class="ruby-identifier">em</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">x</span>
|
205
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">>=</span> <span class="ruby-value">30</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">x</span> <span class="ruby-operator"><=</span> <span class="ruby-value">39</span>
|
206
|
+
<span class="ruby-identifier">rgbf</span> = <span class="ruby-keyword">nil</span>
|
207
|
+
<span class="ruby-identifier">fg</span> = <span class="ruby-identifier">x</span>
|
208
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">>=</span> <span class="ruby-value">40</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">x</span> <span class="ruby-operator"><=</span> <span class="ruby-value">49</span>
|
209
|
+
<span class="ruby-identifier">rgbb</span> = <span class="ruby-keyword">nil</span>
|
210
|
+
<span class="ruby-identifier">bg</span> = <span class="ruby-identifier">x</span>
|
211
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">>=</span> <span class="ruby-value">90</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">x</span> <span class="ruby-operator"><=</span> <span class="ruby-value">97</span>
|
212
|
+
<span class="ruby-identifier">rgbf</span> = <span class="ruby-keyword">nil</span>
|
213
|
+
<span class="ruby-identifier">fg</span> = <span class="ruby-identifier">x</span>
|
214
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">>=</span> <span class="ruby-value">100</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">x</span> <span class="ruby-operator"><=</span> <span class="ruby-value">107</span>
|
215
|
+
<span class="ruby-identifier">rgbb</span> = <span class="ruby-keyword">nil</span>
|
216
|
+
<span class="ruby-identifier">bg</span> = <span class="ruby-identifier">x</span>
|
217
|
+
<span class="ruby-keyword">end</span>
|
218
|
+
<span class="ruby-keyword">end</span>
|
219
|
+
<span class="ruby-keyword">end</span>
|
220
|
+
<span class="ruby-keyword">end</span>
|
221
|
+
|
222
|
+
<span class="ruby-identifier">escape</span> = <span class="ruby-node">"\e[#{em.join(';')}m"</span>
|
223
|
+
<span class="ruby-identifier">escape</span> <span class="ruby-operator">+=</span> <span class="ruby-node">"\e[#{rgbb}m"</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">rgbb</span>
|
224
|
+
<span class="ruby-identifier">escape</span> <span class="ruby-operator">+=</span> <span class="ruby-node">"\e[#{rgbf}m"</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">rgbf</span>
|
225
|
+
<span class="ruby-identifier">escape</span> <span class="ruby-operator">+</span> <span class="ruby-node">"\e[#{[fg, bg].delete_if(&:nil?).join(';')}m"</span>
|
226
|
+
<span class="ruby-keyword">end</span></pre>
|
227
|
+
</div>
|
228
|
+
</div>
|
229
|
+
|
230
|
+
|
231
|
+
</div>
|
232
|
+
|
233
|
+
<div id="method-i-matches" class="method-detail ">
|
234
|
+
<div class="method-heading">
|
235
|
+
<span class="method-name">matches</span><span
|
236
|
+
class="method-args">(any: [], all: [])</span>
|
237
|
+
<span class="method-click-advice">click to toggle source</span>
|
238
|
+
</div>
|
239
|
+
|
240
|
+
<div class="method-description">
|
241
|
+
|
242
|
+
|
243
|
+
<div class="method-source-code" id="matches-source">
|
244
|
+
<pre><span class="ruby-comment"># File lib/na/string.rb, line 25</span>
|
245
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">matches</span>(<span class="ruby-value">any:</span> [], <span class="ruby-value">all:</span> [])
|
246
|
+
<span class="ruby-identifier">matches_any</span>(<span class="ruby-identifier">any</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">matches_all</span>(<span class="ruby-identifier">all</span>)
|
247
|
+
<span class="ruby-keyword">end</span></pre>
|
248
|
+
</div>
|
249
|
+
</div>
|
250
|
+
|
251
|
+
|
252
|
+
</div>
|
253
|
+
|
254
|
+
<div id="method-i-matches_all" class="method-detail ">
|
255
|
+
<div class="method-heading">
|
256
|
+
<span class="method-name">matches_all</span><span
|
257
|
+
class="method-args">(regexes)</span>
|
258
|
+
<span class="method-click-advice">click to toggle source</span>
|
259
|
+
</div>
|
260
|
+
|
261
|
+
<div class="method-description">
|
262
|
+
|
263
|
+
|
264
|
+
<div class="method-source-code" id="matches_all-source">
|
265
|
+
<pre><span class="ruby-comment"># File lib/na/string.rb, line 36</span>
|
266
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">matches_all</span>(<span class="ruby-identifier">regexes</span>)
|
267
|
+
<span class="ruby-identifier">regexes</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">rx</span><span class="ruby-operator">|</span>
|
268
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">match</span>(<span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">rx</span>, <span class="ruby-constant">Regexp</span><span class="ruby-operator">::</span><span class="ruby-constant">IGNORECASE</span>))
|
269
|
+
<span class="ruby-keyword">end</span>
|
270
|
+
<span class="ruby-keyword">true</span>
|
271
|
+
<span class="ruby-keyword">end</span></pre>
|
272
|
+
</div>
|
273
|
+
</div>
|
274
|
+
|
275
|
+
|
276
|
+
</div>
|
277
|
+
|
278
|
+
<div id="method-i-matches_any" class="method-detail ">
|
279
|
+
<div class="method-heading">
|
280
|
+
<span class="method-name">matches_any</span><span
|
281
|
+
class="method-args">(regexes)</span>
|
282
|
+
<span class="method-click-advice">click to toggle source</span>
|
283
|
+
</div>
|
284
|
+
|
285
|
+
<div class="method-description">
|
286
|
+
|
287
|
+
|
288
|
+
<div class="method-source-code" id="matches_any-source">
|
289
|
+
<pre><span class="ruby-comment"># File lib/na/string.rb, line 29</span>
|
290
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">matches_any</span>(<span class="ruby-identifier">regexes</span>)
|
291
|
+
<span class="ruby-identifier">regexes</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">rx</span><span class="ruby-operator">|</span>
|
292
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">match</span>(<span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">rx</span>, <span class="ruby-constant">Regexp</span><span class="ruby-operator">::</span><span class="ruby-constant">IGNORECASE</span>))
|
293
|
+
<span class="ruby-keyword">end</span>
|
294
|
+
<span class="ruby-keyword">false</span>
|
295
|
+
<span class="ruby-keyword">end</span></pre>
|
296
|
+
</div>
|
297
|
+
</div>
|
298
|
+
|
299
|
+
|
300
|
+
</div>
|
301
|
+
|
302
|
+
<div id="method-i-normalize_color" class="method-detail ">
|
303
|
+
<div class="method-heading">
|
304
|
+
<span class="method-name">normalize_color</span><span
|
305
|
+
class="method-args">()</span>
|
306
|
+
<span class="method-click-advice">click to toggle source</span>
|
307
|
+
</div>
|
308
|
+
|
309
|
+
<div class="method-description">
|
310
|
+
<p>Normalize a color name, removing underscores, replacing “bright” with “bold”, and converting bgbold to boldbg</p>
|
311
|
+
|
312
|
+
<p>@return [String] Normalized color name</p>
|
313
|
+
|
314
|
+
<div class="method-source-code" id="normalize_color-source">
|
315
|
+
<pre><span class="ruby-comment"># File lib/na/colors.rb, line 129</span>
|
316
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">normalize_color</span>
|
317
|
+
<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/_/</span>, <span class="ruby-string">''</span>).<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/bright/i</span>, <span class="ruby-string">'bold'</span>).<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/bgbold/</span>, <span class="ruby-string">'boldbg'</span>)
|
318
|
+
<span class="ruby-keyword">end</span></pre>
|
319
|
+
</div>
|
320
|
+
</div>
|
321
|
+
|
322
|
+
|
323
|
+
</div>
|
324
|
+
|
325
|
+
<div id="method-i-validate_color" class="method-detail ">
|
326
|
+
<div class="method-heading">
|
327
|
+
<span class="method-name">validate_color</span><span
|
328
|
+
class="method-args">()</span>
|
329
|
+
<span class="method-click-advice">click to toggle source</span>
|
330
|
+
</div>
|
331
|
+
|
332
|
+
<div class="method-description">
|
333
|
+
<p>Extract the longest valid %color name from a string.</p>
|
334
|
+
|
335
|
+
<p>Allows %colors to bleed into other text and still be recognized, e.g. %greensomething still finds %green.</p>
|
336
|
+
|
337
|
+
<p>@return [String] a valid color name</p>
|
338
|
+
|
339
|
+
<div class="method-source-code" id="validate_color-source">
|
340
|
+
<pre><span class="ruby-comment"># File lib/na/colors.rb, line 111</span>
|
341
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_color</span>
|
342
|
+
<span class="ruby-identifier">valid_color</span> = <span class="ruby-keyword">nil</span>
|
343
|
+
<span class="ruby-identifier">compiled</span> = <span class="ruby-string">''</span>
|
344
|
+
<span class="ruby-identifier">normalize_color</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">''</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">char</span><span class="ruby-operator">|</span>
|
345
|
+
<span class="ruby-identifier">compiled</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">char</span>
|
346
|
+
<span class="ruby-identifier">valid_color</span> = <span class="ruby-identifier">compiled</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">Color</span>.<span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">compiled</span>.<span class="ruby-identifier">to_sym</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">compiled</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^([fb]g?)?#([a-f0-9]{6})$/i</span>
|
347
|
+
<span class="ruby-keyword">end</span>
|
348
|
+
|
349
|
+
<span class="ruby-identifier">valid_color</span>
|
350
|
+
<span class="ruby-keyword">end</span></pre>
|
351
|
+
</div>
|
352
|
+
</div>
|
353
|
+
|
354
|
+
|
355
|
+
</div>
|
356
|
+
|
357
|
+
</section>
|
358
|
+
|
359
|
+
</section>
|
360
|
+
</main>
|
361
|
+
|
362
|
+
|
363
|
+
<footer id="validator-badges" role="contentinfo">
|
364
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
365
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.3.3.
|
366
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
367
|
+
</footer>
|
368
|
+
|
data/html/created.rid
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
Tue, 27 Sep 2022 10:51:50 -0500
|
2
|
+
README.rdoc Tue, 27 Sep 2022 10:44:08 -0500
|
3
|
+
lib/na.rb Tue, 27 Sep 2022 05:21:27 -0500
|
4
|
+
lib/na/action.rb Tue, 27 Sep 2022 09:38:32 -0500
|
5
|
+
lib/na/colors.rb Tue, 27 Sep 2022 03:25:39 -0500
|
6
|
+
lib/na/next_action.rb Tue, 27 Sep 2022 10:13:13 -0500
|
7
|
+
lib/na/string.rb Tue, 27 Sep 2022 09:37:41 -0500
|
8
|
+
lib/na/version.rb Tue, 27 Sep 2022 07:26:43 -0500
|
9
|
+
bin/na Tue, 27 Sep 2022 10:42:39 -0500
|
data/html/css/fonts.css
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/),
|
3
|
+
* with Reserved Font Name "Source". All Rights Reserved. Source is a
|
4
|
+
* trademark of Adobe Systems Incorporated in the United States and/or other
|
5
|
+
* countries.
|
6
|
+
*
|
7
|
+
* This Font Software is licensed under the SIL Open Font License, Version
|
8
|
+
* 1.1.
|
9
|
+
*
|
10
|
+
* This license is copied below, and is also available with a FAQ at:
|
11
|
+
* http://scripts.sil.org/OFL
|
12
|
+
*/
|
13
|
+
|
14
|
+
@font-face {
|
15
|
+
font-family: "Source Code Pro";
|
16
|
+
font-style: normal;
|
17
|
+
font-weight: 400;
|
18
|
+
src: local("Source Code Pro"),
|
19
|
+
local("SourceCodePro-Regular"),
|
20
|
+
url("../fonts/SourceCodePro-Regular.ttf") format("truetype");
|
21
|
+
}
|
22
|
+
|
23
|
+
@font-face {
|
24
|
+
font-family: "Source Code Pro";
|
25
|
+
font-style: normal;
|
26
|
+
font-weight: 700;
|
27
|
+
src: local("Source Code Pro Bold"),
|
28
|
+
local("SourceCodePro-Bold"),
|
29
|
+
url("../fonts/SourceCodePro-Bold.ttf") format("truetype");
|
30
|
+
}
|
31
|
+
|
32
|
+
/*
|
33
|
+
* Copyright (c) 2010, Łukasz Dziedzic (dziedzic@typoland.com),
|
34
|
+
* with Reserved Font Name Lato.
|
35
|
+
*
|
36
|
+
* This Font Software is licensed under the SIL Open Font License, Version
|
37
|
+
* 1.1.
|
38
|
+
*
|
39
|
+
* This license is copied below, and is also available with a FAQ at:
|
40
|
+
* http://scripts.sil.org/OFL
|
41
|
+
*/
|
42
|
+
|
43
|
+
@font-face {
|
44
|
+
font-family: "Lato";
|
45
|
+
font-style: normal;
|
46
|
+
font-weight: 300;
|
47
|
+
src: local("Lato Light"),
|
48
|
+
local("Lato-Light"),
|
49
|
+
url("../fonts/Lato-Light.ttf") format("truetype");
|
50
|
+
}
|
51
|
+
|
52
|
+
@font-face {
|
53
|
+
font-family: "Lato";
|
54
|
+
font-style: italic;
|
55
|
+
font-weight: 300;
|
56
|
+
src: local("Lato Light Italic"),
|
57
|
+
local("Lato-LightItalic"),
|
58
|
+
url("../fonts/Lato-LightItalic.ttf") format("truetype");
|
59
|
+
}
|
60
|
+
|
61
|
+
@font-face {
|
62
|
+
font-family: "Lato";
|
63
|
+
font-style: normal;
|
64
|
+
font-weight: 700;
|
65
|
+
src: local("Lato Regular"),
|
66
|
+
local("Lato-Regular"),
|
67
|
+
url("../fonts/Lato-Regular.ttf") format("truetype");
|
68
|
+
}
|
69
|
+
|
70
|
+
@font-face {
|
71
|
+
font-family: "Lato";
|
72
|
+
font-style: italic;
|
73
|
+
font-weight: 700;
|
74
|
+
src: local("Lato Italic"),
|
75
|
+
local("Lato-Italic"),
|
76
|
+
url("../fonts/Lato-RegularItalic.ttf") format("truetype");
|
77
|
+
}
|
78
|
+
|
79
|
+
/*
|
80
|
+
* -----------------------------------------------------------
|
81
|
+
* SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
82
|
+
* -----------------------------------------------------------
|
83
|
+
*
|
84
|
+
* PREAMBLE
|
85
|
+
* The goals of the Open Font License (OFL) are to stimulate worldwide
|
86
|
+
* development of collaborative font projects, to support the font creation
|
87
|
+
* efforts of academic and linguistic communities, and to provide a free and
|
88
|
+
* open framework in which fonts may be shared and improved in partnership
|
89
|
+
* with others.
|
90
|
+
*
|
91
|
+
* The OFL allows the licensed fonts to be used, studied, modified and
|
92
|
+
* redistributed freely as long as they are not sold by themselves. The
|
93
|
+
* fonts, including any derivative works, can be bundled, embedded,
|
94
|
+
* redistributed and/or sold with any software provided that any reserved
|
95
|
+
* names are not used by derivative works. The fonts and derivatives,
|
96
|
+
* however, cannot be released under any other type of license. The
|
97
|
+
* requirement for fonts to remain under this license does not apply
|
98
|
+
* to any document created using the fonts or their derivatives.
|
99
|
+
*
|
100
|
+
* DEFINITIONS
|
101
|
+
* "Font Software" refers to the set of files released by the Copyright
|
102
|
+
* Holder(s) under this license and clearly marked as such. This may
|
103
|
+
* include source files, build scripts and documentation.
|
104
|
+
*
|
105
|
+
* "Reserved Font Name" refers to any names specified as such after the
|
106
|
+
* copyright statement(s).
|
107
|
+
*
|
108
|
+
* "Original Version" refers to the collection of Font Software components as
|
109
|
+
* distributed by the Copyright Holder(s).
|
110
|
+
*
|
111
|
+
* "Modified Version" refers to any derivative made by adding to, deleting,
|
112
|
+
* or substituting -- in part or in whole -- any of the components of the
|
113
|
+
* Original Version, by changing formats or by porting the Font Software to a
|
114
|
+
* new environment.
|
115
|
+
*
|
116
|
+
* "Author" refers to any designer, engineer, programmer, technical
|
117
|
+
* writer or other person who contributed to the Font Software.
|
118
|
+
*
|
119
|
+
* PERMISSION & CONDITIONS
|
120
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
121
|
+
* a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
122
|
+
* redistribute, and sell modified and unmodified copies of the Font
|
123
|
+
* Software, subject to the following conditions:
|
124
|
+
*
|
125
|
+
* 1) Neither the Font Software nor any of its individual components,
|
126
|
+
* in Original or Modified Versions, may be sold by itself.
|
127
|
+
*
|
128
|
+
* 2) Original or Modified Versions of the Font Software may be bundled,
|
129
|
+
* redistributed and/or sold with any software, provided that each copy
|
130
|
+
* contains the above copyright notice and this license. These can be
|
131
|
+
* included either as stand-alone text files, human-readable headers or
|
132
|
+
* in the appropriate machine-readable metadata fields within text or
|
133
|
+
* binary files as long as those fields can be easily viewed by the user.
|
134
|
+
*
|
135
|
+
* 3) No Modified Version of the Font Software may use the Reserved Font
|
136
|
+
* Name(s) unless explicit written permission is granted by the corresponding
|
137
|
+
* Copyright Holder. This restriction only applies to the primary font name as
|
138
|
+
* presented to the users.
|
139
|
+
*
|
140
|
+
* 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
141
|
+
* Software shall not be used to promote, endorse or advertise any
|
142
|
+
* Modified Version, except to acknowledge the contribution(s) of the
|
143
|
+
* Copyright Holder(s) and the Author(s) or with their explicit written
|
144
|
+
* permission.
|
145
|
+
*
|
146
|
+
* 5) The Font Software, modified or unmodified, in part or in whole,
|
147
|
+
* must be distributed entirely under this license, and must not be
|
148
|
+
* distributed under any other license. The requirement for fonts to
|
149
|
+
* remain under this license does not apply to any document created
|
150
|
+
* using the Font Software.
|
151
|
+
*
|
152
|
+
* TERMINATION
|
153
|
+
* This license becomes null and void if any of the above conditions are
|
154
|
+
* not met.
|
155
|
+
*
|
156
|
+
* DISCLAIMER
|
157
|
+
* THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
158
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
159
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
160
|
+
* OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
161
|
+
* COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
162
|
+
* INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
163
|
+
* DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
164
|
+
* FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
165
|
+
* OTHER DEALINGS IN THE FONT SOFTWARE.
|
166
|
+
*/
|
167
|
+
|