forked from samuel-velazquez/gpm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
339 lines (198 loc) · 10.7 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
<!DOCTYPE html>
<html>
<head>
<title>Ruby for Node</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" media="all" href="assets/css/style.css" />
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.4/semantic.min.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.8.0/styles/tomorrow-night.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.8.0/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.4/semantic.min.js"></script>
<script src="assets/js/javascript.js"></script>
</head>
<body>
<div class="ui left push vertical inverted sidebar menu">
<a class="item menu-link" href="index.html">
Index
</a>
<a class="item menu-link" href="integer.html">
Integer
</a>
<a class="item menu-link" href="percent_strings.html">
Percent Strings
</a>
<a class="item menu-link" href="stdout.html">
Stdout
</a>
<a class="item menu-link" href="string.html">
String
</a>
</div>
<div class='pusher'>
<div id='menu-buttons' class='ui fixed top sticky'>
<div class='ui basic button icon' id='menu-button'>
<i class='icon sidebar'></i>
</div>
<a href='https://github.com/crookedneighbor/ruby-node/blob/master/src/index.js' class='ui basic button icon' data-content="View Source Code">
<i class='icon code'></i>
</a>
</div>
<div id="background" class="hljs"></div>
<div id="container" class="ui container">
<div class="ui middle aligned two column grid">
<h2 class="ui icon header center aligned column">
<i class="diamond icon"></i>
Ruby for Node
<div class="sub header">Helper methods from ruby ported to Node.</div>
</h2>
<div class='column'></div>
</div>
<div class="sections">
<div id="Getting Started
```bash
npm install ruby --save
```
```js" class="section-2 ui middle aligned two column grid">
<div class="annotation column">
<a class='section-link' href="#Getting Started
```bash
npm install ruby --save
```
```js">
<i class="linkify icon"></i>
</a>
<h1 id="getting-started">Getting Started</h1>
<pre><code class="lang-bash">npm install ruby --save
</code></pre>
<pre><code class="lang-js"><span class="hljs-keyword">let</span> r = <span class="hljs-built_in">require</span>(<span class="hljs-string">'ruby'</span>);
<span class="hljs-keyword">let</span> words = r.w(<span class="hljs-string">'I am not throwing away my shot!'</span>);
words; <span class="hljs-comment">// ['I', 'am', 'not', 'throwing', 'away', 'my', 'shot!']</span>
</code></pre>
</div>
</div>
<div id="" class="section-4 ui middle aligned two column grid">
<div class="annotation column">
<a class='section-link' href="#">
<i class="linkify icon"></i>
</a>
<h1 id="-stdout-docs-stdout-html-">$stdout - <a href="stdout.html">Docs</a></h1>
<p>A collection of methods that output to stdout. All the methods
are available both on the $stdout object and as standalone methods.</p>
<ul>
<li><a href="stdout.html#putc">putc</a></li>
<li><a href="stdout.html#puts">puts</a></li>
</ul>
</div>
<div class="content column hljs javascript"><div class='highlight'><pre> <span class="hljs-keyword">this</span>.$stdout = <span class="hljs-keyword">new</span> $Stdout();
assign(<span class="hljs-keyword">this</span>, <span class="hljs-keyword">this</span>.$stdout);</pre></div></div>
</div>
<div id="" class="section-5 ui middle aligned two column grid">
<div class="annotation column">
<a class='section-link' href="#">
<i class="linkify icon"></i>
</a>
<h1 id="int-docs-integer-html-">int - <a href="integer.html">Docs</a></h1>
<ul>
<li><a href="integer.html#even">even</a></li>
<li><a href="integer.html#gcd">gcd</a></li>
<li><a href="integer.html#gcdlcm">gcdlcm</a></li>
<li><a href="integer.html#lcm">lcm</a></li>
<li><a href="integer.html#next">next</a></li>
<li><a href="integer.html#odd">odd</a></li>
<li><a href="integer.html#pred">pred</a></li>
<li><a href="integer.html#succ">succ</a></li>
<li><a href="integer.html#times">times</a></li>
<li><a href="integer.html#upto">upto</a></li>
<li><a href="integer.html#to_i">to_i</a></li>
</ul>
</div>
<div class="content column hljs javascript"><div class='highlight'><pre> <span class="hljs-keyword">this</span>.int = <span class="hljs-keyword">new</span> _Integer();</pre></div></div>
</div>
<div id="" class="section-6 ui middle aligned two column grid">
<div class="annotation column">
<a class='section-link' href="#">
<i class="linkify icon"></i>
</a>
<h1 id="str-docs-string-html-">str - <a href="string.html">Docs</a></h1>
<ul>
<li><a href="string.html#chars">chars</a></li>
<li><a href="string.html#downcase">downcase</a></li>
<li><a href="string.html#empty">empty</a></li>
<li><a href="string.html#reverse">reverse</a></li>
<li><a href="string.html#upcase">upcase</a></li>
</ul>
</div>
<div class="content column hljs javascript"><div class='highlight'><pre> <span class="hljs-keyword">this</span>.str = <span class="hljs-keyword">new</span> _String();</pre></div></div>
</div>
<div id="" class="section-7 ui middle aligned two column grid">
<div class="annotation column">
<a class='section-link' href="#">
<i class="linkify icon"></i>
</a>
<h1 id="percent-strings-docs-percent_strings-html-">Percent Strings - <a href="percent_strings.html">Docs</a></h1>
<ul>
<li><a href="percent_strings.html#w">w</a></li>
<li><a href="percent_strings.html#percent_w">percent_w</a></li>
</ul>
</div>
<div class="content column hljs javascript"><div class='highlight'><pre> assign(<span class="hljs-keyword">this</span>, <span class="hljs-keyword">new</span> PercentStrings());</pre></div></div>
</div>
<div id="add_methods_to_number_prototype
" class="section-9 ui middle aligned two column grid">
<div class="annotation column">
<a class='section-link' href="#add_methods_to_number_prototype
">
<i class="linkify icon"></i>
</a>
<h1 id="add_methods_to_number_prototype">add_methods_to_number_prototype</h1>
<p>If you’d like the <a href="integer.html">Integer Methods</a> as attributes on any number, just run this method.</p>
<pre><code class="lang-js">ruby.add_methods_to_number_prototype();
</code></pre>
</div>
<div class="content column hljs javascript"><div class='highlight'><pre> add_methods_to_number_prototype () {
_addMethodsToPrototype(<span class="hljs-built_in">Number</span>.prototype, <span class="hljs-keyword">this</span>.int);
}</pre></div></div>
</div>
<div id="add_methods_to_string_prototype
" class="section-10 ui middle aligned two column grid">
<div class="annotation column">
<a class='section-link' href="#add_methods_to_string_prototype
">
<i class="linkify icon"></i>
</a>
<h1 id="add_methods_to_string_prototype">add_methods_to_string_prototype</h1>
<p>If you’d like the <a href="string.html">String Methods</a> as attributes on any string, just run this method.</p>
<pre><code class="lang-js">ruby.add_methods_to_string_prototype();
</code></pre>
</div>
<div class="content column hljs javascript"><div class='highlight'><pre> add_methods_to_string_prototype () {
_addMethodsToPrototype(<span class="hljs-built_in">String</span>.prototype, <span class="hljs-keyword">this</span>.str);
}</pre></div></div>
</div>
<div id="" class="section-12 ui middle aligned two column grid">
<div class="annotation column">
<a class='section-link' href="#">
<i class="linkify icon"></i>
</a>
<p>More than one argument indicates that the second is a block</p>
</div>
<div class="content column hljs javascript"><div class='highlight'><pre> <span class="hljs-keyword">if</span> (method.length > <span class="hljs-number">1</span>) {
prototype[method_name] = _generate_method_with_block(method);
} <span class="hljs-keyword">else</span> {
<span class="hljs-built_in">Object</span>.defineProperty(
prototype,
method_name,
{ get: method }
);
}
});
}
<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">new</span> Ruby();</pre></div></div>
</div>
</div>
</div>
</div>
</body>
</html>