bovem 2.0.3 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis-gemfile +13 -0
- data/.travis.yml +4 -2
- data/Gemfile +13 -1
- data/bovem.gemspec +2 -10
- data/doc/Bovem.html +3 -3
- data/doc/Bovem/Configuration.html +14 -12
- data/doc/Bovem/Console.html +155 -301
- data/doc/Bovem/ConsoleMethods.html +3 -3
- data/doc/Bovem/ConsoleMethods/Interactions.html +36 -44
- data/doc/Bovem/ConsoleMethods/Interactions/ClassMethods.html +7 -7
- data/doc/Bovem/ConsoleMethods/Logging.html +62 -62
- data/doc/Bovem/ConsoleMethods/Logging/ClassMethods.html +7 -7
- data/doc/Bovem/ConsoleMethods/Output.html +59 -141
- data/doc/Bovem/ConsoleMethods/StyleHandling.html +3 -3
- data/doc/Bovem/ConsoleMethods/StyleHandling/ClassMethods.html +4 -4
- data/doc/Bovem/Errors.html +3 -3
- data/doc/Bovem/Errors/InvalidConfiguration.html +3 -3
- data/doc/Bovem/Errors/InvalidLogger.html +3 -3
- data/doc/Bovem/Logger.html +3 -3
- data/doc/Bovem/Shell.html +22 -22
- data/doc/Bovem/ShellMethods.html +3 -3
- data/doc/Bovem/ShellMethods/Directories.html +21 -21
- data/doc/Bovem/ShellMethods/Execute.html +21 -21
- data/doc/Bovem/ShellMethods/General.html +130 -20
- data/doc/Bovem/ShellMethods/Read.html +21 -21
- data/doc/Bovem/ShellMethods/Write.html +20 -20
- data/doc/Bovem/Version.html +5 -5
- data/doc/_index.html +4 -4
- data/doc/file.README.html +3 -3
- data/doc/frames.html +1 -1
- data/doc/index.html +3 -3
- data/doc/method_list.html +43 -51
- data/doc/top-level-namespace.html +3 -3
- data/lib/bovem.rb +1 -1
- data/lib/bovem/configuration.rb +12 -4
- data/lib/bovem/console.rb +25 -46
- data/lib/bovem/shell.rb +12 -5
- data/lib/bovem/version.rb +2 -2
- data/spec/bovem/configuration_spec.rb +3 -3
- data/spec/bovem/console_spec.rb +12 -30
- data/spec/bovem/shell_spec.rb +17 -2
- metadata +6 -118
data/.travis-gemfile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# This file is part of the bovem gem. Copyright (C) 2013 and above Shogun <shogun_panda@me.com>.
|
4
|
+
# Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
|
5
|
+
#
|
6
|
+
|
7
|
+
source "http://rubygems.org"
|
8
|
+
|
9
|
+
gemspec
|
10
|
+
|
11
|
+
# Testing
|
12
|
+
gem "rspec", "~> 2.12.0"
|
13
|
+
gem "rake", "~> 10.0.3"
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -6,4 +6,16 @@
|
|
6
6
|
|
7
7
|
source "http://rubygems.org"
|
8
8
|
|
9
|
-
gemspec
|
9
|
+
gemspec
|
10
|
+
|
11
|
+
# Testing
|
12
|
+
gem "rspec", "~> 2.12.0"
|
13
|
+
gem "rake", "~> 10.0.3"
|
14
|
+
|
15
|
+
# Documentation
|
16
|
+
gem "simplecov", ">= 0.7.1"
|
17
|
+
gem "pry", ">= 0"
|
18
|
+
gem "yard", ">= 0.8.4"
|
19
|
+
gem "redcarpet", ">= 2.2.2"
|
20
|
+
gem "github-markup", ">= 0.7.5"
|
21
|
+
|
data/bovem.gemspec
CHANGED
@@ -21,16 +21,8 @@ Gem::Specification.new do |gem|
|
|
21
21
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
22
22
|
gem.require_paths = ["lib"]
|
23
23
|
|
24
|
-
gem.required_ruby_version = ">= 1.9.
|
24
|
+
gem.required_ruby_version = ">= 1.9.3"
|
25
25
|
|
26
|
-
gem.add_dependency("lazier", "~> 2.
|
26
|
+
gem.add_dependency("lazier", "~> 2.6.3")
|
27
27
|
gem.add_dependency("open4", "~> 1.3.0")
|
28
|
-
|
29
|
-
gem.add_development_dependency("rspec", "~> 2.12.0")
|
30
|
-
gem.add_development_dependency("rake", "~> 10.0.3")
|
31
|
-
gem.add_development_dependency("simplecov", "~> 0.7.1")
|
32
|
-
gem.add_development_dependency("pry", ">= 0")
|
33
|
-
gem.add_development_dependency("yard", "~> 0.8.3")
|
34
|
-
gem.add_development_dependency("redcarpet", "~> 2.2.2")
|
35
|
-
gem.add_development_dependency("github-markup", "~> 0.7.5")
|
36
28
|
end
|
data/doc/Bovem.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Module: Bovem
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.
|
9
|
+
— Documentation by YARD 0.8.4
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -158,9 +158,9 @@ Licensed under the MIT license, which can be found at <a href="http://www.openso
|
|
158
158
|
</div>
|
159
159
|
|
160
160
|
<div id="footer">
|
161
|
-
Generated on
|
161
|
+
Generated on Tue Feb 5 13:31:46 2013 by
|
162
162
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
163
|
-
0.8.
|
163
|
+
0.8.4 (ruby-1.9.3).
|
164
164
|
</div>
|
165
165
|
|
166
166
|
</body>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Class: Bovem::Configuration
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.
|
9
|
+
— Documentation by YARD 0.8.4
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -110,7 +110,7 @@
|
|
110
110
|
<p>Extend this class and add valid properties via <span class='object_link'><a href="#property-class_method" title="Bovem::Configuration.property (method)">property</a></span> method.
|
111
111
|
Example:</p>
|
112
112
|
|
113
|
-
<pre class="code ruby"><code>class MyConfiguration << Bovem::Configuration
|
113
|
+
<pre class="code ruby"><code class="ruby">class MyConfiguration << Bovem::Configuration
|
114
114
|
property :property, :default => "VALUE"
|
115
115
|
end
|
116
116
|
|
@@ -317,12 +317,14 @@ config.property = "VALUE"
|
|
317
317
|
|
318
318
|
32
|
319
319
|
33
|
320
|
-
34
|
320
|
+
34
|
321
|
+
35</pre>
|
321
322
|
</td>
|
322
323
|
<td>
|
323
324
|
<pre class="code"><span class="info file"># File 'lib/bovem/configuration.rb', line 32</span>
|
324
325
|
|
325
326
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_overrides'>overrides</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='id identifier rubyid_logger'>logger</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
327
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='symbol'>:bovem</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
|
326
328
|
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_overrides'>overrides</span><span class='comma'>,</span> <span class='id identifier rubyid_logger'>logger</span><span class='rparen'>)</span>
|
327
329
|
<span class='kw'>end</span></pre>
|
328
330
|
</td>
|
@@ -398,7 +400,6 @@ config.property = "VALUE"
|
|
398
400
|
<pre class="lines">
|
399
401
|
|
400
402
|
|
401
|
-
74
|
402
403
|
75
|
403
404
|
76
|
404
405
|
77
|
@@ -408,10 +409,11 @@ config.property = "VALUE"
|
|
408
409
|
81
|
409
410
|
82
|
410
411
|
83
|
411
|
-
84
|
412
|
+
84
|
413
|
+
85</pre>
|
412
414
|
</td>
|
413
415
|
<td>
|
414
|
-
<pre class="code"><span class="info file"># File 'lib/bovem/configuration.rb', line
|
416
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/configuration.rb', line 75</span>
|
415
417
|
|
416
418
|
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_property'>property</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
417
419
|
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
|
@@ -452,7 +454,7 @@ config.property = "VALUE"
|
|
452
454
|
|
453
455
|
<p>Example:</p>
|
454
456
|
|
455
|
-
<pre class="code ruby"><code><span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_property'>property</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>VALUE</span><span class='tstring_end'>"</span></span>
|
457
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_property'>property</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>VALUE</span><span class='tstring_end'>"</span></span>
|
456
458
|
</code></pre>
|
457
459
|
|
458
460
|
|
@@ -522,7 +524,6 @@ config.property = "VALUE"
|
|
522
524
|
<pre class="lines">
|
523
525
|
|
524
526
|
|
525
|
-
49
|
526
527
|
50
|
527
528
|
51
|
528
529
|
52
|
@@ -541,10 +542,11 @@ config.property = "VALUE"
|
|
541
542
|
65
|
542
543
|
66
|
543
544
|
67
|
544
|
-
68
|
545
|
+
68
|
546
|
+
69</pre>
|
545
547
|
</td>
|
546
548
|
<td>
|
547
|
-
<pre class="code"><span class="info file"># File 'lib/bovem/configuration.rb', line
|
549
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/configuration.rb', line 50</span>
|
548
550
|
|
549
551
|
<span class='kw'>def</span> <span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_overrides'>overrides</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='id identifier rubyid_logger'>logger</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
550
552
|
<span class='id identifier rubyid_file'>file</span> <span class='op'>=</span> <span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>?</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
@@ -576,9 +578,9 @@ config.property = "VALUE"
|
|
576
578
|
</div>
|
577
579
|
|
578
580
|
<div id="footer">
|
579
|
-
Generated on
|
581
|
+
Generated on Tue Feb 5 13:31:47 2013 by
|
580
582
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
581
|
-
0.8.
|
583
|
+
0.8.4 (ruby-1.9.3).
|
582
584
|
</div>
|
583
585
|
|
584
586
|
</body>
|
data/doc/Bovem/Console.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Class: Bovem::Console
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.
|
9
|
+
— Documentation by YARD 0.8.4
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -172,36 +172,23 @@
|
|
172
172
|
</li>
|
173
173
|
|
174
174
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
<a href="#line_width-instance_method" title="#line_width (instance method)">- (Fixnum) <strong>line_width</strong> </a>
|
179
|
-
|
175
|
+
</ul>
|
176
|
+
|
177
|
+
|
180
178
|
|
181
|
-
|
182
|
-
</span>
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
179
|
|
194
180
|
|
195
|
-
<
|
196
|
-
|
197
|
-
|
198
|
-
</
|
181
|
+
<h2>
|
182
|
+
Class Method Summary
|
183
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
184
|
+
</h2>
|
199
185
|
|
200
|
-
|
201
|
-
|
186
|
+
<ul class="summary">
|
187
|
+
|
188
|
+
<li class="public ">
|
202
189
|
<span class="summary_signature">
|
203
190
|
|
204
|
-
<a href="#
|
191
|
+
<a href="#instance-class_method" title="instance (class method)">+ (Console) <strong>instance</strong> </a>
|
205
192
|
|
206
193
|
|
207
194
|
|
@@ -209,29 +196,22 @@
|
|
209
196
|
|
210
197
|
|
211
198
|
|
212
|
-
|
213
|
-
|
214
|
-
|
215
199
|
|
216
200
|
|
217
201
|
|
218
202
|
|
219
203
|
|
220
204
|
|
221
|
-
<span class="summary_desc"><div class='inline'><p>
|
205
|
+
<span class="summary_desc"><div class='inline'><p>Returns a unique instance for Console.</p>
|
222
206
|
</div></span>
|
223
207
|
|
224
208
|
</li>
|
225
209
|
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
210
|
+
|
211
|
+
</ul>
|
232
212
|
|
233
213
|
<h2>
|
234
|
-
|
214
|
+
Instance Method Summary
|
235
215
|
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
236
216
|
</h2>
|
237
217
|
|
@@ -240,13 +220,15 @@
|
|
240
220
|
<li class="public ">
|
241
221
|
<span class="summary_signature">
|
242
222
|
|
243
|
-
<a href="#
|
223
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Console) <strong>initialize</strong> </a>
|
244
224
|
|
245
225
|
|
246
226
|
|
247
227
|
</span>
|
248
228
|
|
249
229
|
|
230
|
+
<span class="note title constructor">constructor</span>
|
231
|
+
|
250
232
|
|
251
233
|
|
252
234
|
|
@@ -254,33 +236,22 @@
|
|
254
236
|
|
255
237
|
|
256
238
|
|
257
|
-
<span class="summary_desc"><div class='inline'><p>
|
239
|
+
<span class="summary_desc"><div class='inline'><p>Initializes a new Console.</p>
|
258
240
|
</div></span>
|
259
241
|
|
260
242
|
</li>
|
261
243
|
|
262
244
|
|
263
|
-
</ul>
|
264
|
-
|
265
|
-
<h2>
|
266
|
-
Instance Method Summary
|
267
|
-
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
268
|
-
</h2>
|
269
|
-
|
270
|
-
<ul class="summary">
|
271
|
-
|
272
245
|
<li class="public ">
|
273
246
|
<span class="summary_signature">
|
274
247
|
|
275
|
-
<a href="#
|
248
|
+
<a href="#line_width-instance_method" title="#line_width (instance method)">- (Fixnum) <strong>line_width</strong> </a>
|
276
249
|
|
277
250
|
|
278
251
|
|
279
252
|
</span>
|
280
253
|
|
281
254
|
|
282
|
-
<span class="note title constructor">constructor</span>
|
283
|
-
|
284
255
|
|
285
256
|
|
286
257
|
|
@@ -288,7 +259,7 @@
|
|
288
259
|
|
289
260
|
|
290
261
|
|
291
|
-
<span class="summary_desc"><div class='inline'><p>
|
262
|
+
<span class="summary_desc"><div class='inline'><p>Get the width of the terminal.</p>
|
292
263
|
</div></span>
|
293
264
|
|
294
265
|
</li>
|
@@ -331,7 +302,7 @@
|
|
331
302
|
|
332
303
|
|
333
304
|
<h3 class="inherited">Methods included from <span class='object_link'><a href="ConsoleMethods/Output.html" title="Bovem::ConsoleMethods::Output (module)">Bovem::ConsoleMethods::Output</a></span></h3>
|
334
|
-
<p class="inherited"><span class='object_link'><a href="ConsoleMethods/Output.html#format-instance_method" title="Bovem::ConsoleMethods::Output#format (method)">#format</a></span>, <span class='object_link'><a href="ConsoleMethods/Output.html#format_right-instance_method" title="Bovem::ConsoleMethods::Output#format_right (method)">#format_right</a></span>, <span class='object_link'><a href="ConsoleMethods/Output.html#
|
305
|
+
<p class="inherited"><span class='object_link'><a href="ConsoleMethods/Output.html#format-instance_method" title="Bovem::ConsoleMethods::Output#format (method)">#format</a></span>, <span class='object_link'><a href="ConsoleMethods/Output.html#format_right-instance_method" title="Bovem::ConsoleMethods::Output#format_right (method)">#format_right</a></span>, <span class='object_link'><a href="ConsoleMethods/Output.html#indent-instance_method" title="Bovem::ConsoleMethods::Output#indent (method)">#indent</a></span>, <span class='object_link'><a href="ConsoleMethods/Output.html#reset_indentation-instance_method" title="Bovem::ConsoleMethods::Output#reset_indentation (method)">#reset_indentation</a></span>, <span class='object_link'><a href="ConsoleMethods/Output.html#set_indentation-instance_method" title="Bovem::ConsoleMethods::Output#set_indentation (method)">#set_indentation</a></span>, <span class='object_link'><a href="ConsoleMethods/Output.html#with_indentation-instance_method" title="Bovem::ConsoleMethods::Output#with_indentation (method)">#with_indentation</a></span>, <span class='object_link'><a href="ConsoleMethods/Output.html#wrap-instance_method" title="Bovem::ConsoleMethods::Output#wrap (method)">#wrap</a></span></p>
|
335
306
|
|
336
307
|
|
337
308
|
|
@@ -373,22 +344,18 @@
|
|
373
344
|
<pre class="lines">
|
374
345
|
|
375
346
|
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
645
|
382
|
-
646</pre>
|
347
|
+
609
|
348
|
+
610
|
349
|
+
611
|
350
|
+
612
|
351
|
+
613</pre>
|
383
352
|
</td>
|
384
353
|
<td>
|
385
|
-
<pre class="code"><span class="info file"># File 'lib/bovem/console.rb', line
|
354
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/console.rb', line 609</span>
|
386
355
|
|
387
356
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
388
|
-
<span class='ivar'>@line_width</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_get_screen_width'>get_screen_width</span>
|
389
357
|
<span class='ivar'>@indentation</span> <span class='op'>=</span> <span class='int'>0</span>
|
390
358
|
<span class='ivar'>@indentation_string</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> </span><span class='tstring_end'>"</span></span>
|
391
|
-
<span class='ivar'>@stty</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Console</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>which stty</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
|
392
359
|
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='symbol'>:bovem</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
|
393
360
|
<span class='kw'>end</span></pre>
|
394
361
|
</td>
|
@@ -445,41 +412,47 @@
|
|
445
412
|
<pre class="lines">
|
446
413
|
|
447
414
|
|
415
|
+
591
|
416
|
+
592
|
417
|
+
593
|
418
|
+
594
|
419
|
+
595
|
420
|
+
596
|
421
|
+
597
|
422
|
+
598
|
423
|
+
599
|
424
|
+
600
|
425
|
+
601
|
426
|
+
602
|
427
|
+
603
|
428
|
+
604
|
429
|
+
605
|
430
|
+
606
|
431
|
+
607
|
432
|
+
608
|
433
|
+
609
|
434
|
+
610
|
435
|
+
611
|
436
|
+
612
|
437
|
+
613
|
438
|
+
614
|
439
|
+
615
|
440
|
+
616
|
441
|
+
617
|
442
|
+
618
|
443
|
+
619
|
448
444
|
620
|
449
445
|
621
|
450
446
|
622
|
451
447
|
623
|
452
448
|
624
|
453
449
|
625
|
454
|
-
626
|
455
|
-
627
|
456
|
-
628
|
457
|
-
629
|
458
|
-
630
|
459
|
-
631
|
460
|
-
632
|
461
|
-
633
|
462
|
-
634
|
463
|
-
635
|
464
|
-
636
|
465
|
-
637
|
466
|
-
638
|
467
|
-
639
|
468
|
-
640
|
469
|
-
641
|
470
|
-
642
|
471
|
-
643
|
472
|
-
644
|
473
|
-
645
|
474
|
-
646
|
475
|
-
647</pre>
|
450
|
+
626</pre>
|
476
451
|
</td>
|
477
452
|
<td>
|
478
|
-
<pre class="code"><span class="info file"># File 'lib/bovem/console.rb', line
|
453
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/console.rb', line 591</span>
|
479
454
|
|
480
455
|
<span class='kw'>class</span> <span class='const'>Console</span>
|
481
|
-
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:line_width</span>
|
482
|
-
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:screen_width</span>
|
483
456
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:indentation</span>
|
484
457
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:indentation_string</span>
|
485
458
|
|
@@ -498,12 +471,22 @@
|
|
498
471
|
|
499
472
|
<span class='comment'># Initializes a new Console.
|
500
473
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
501
|
-
<span class='ivar'>@line_width</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_get_screen_width'>get_screen_width</span>
|
502
474
|
<span class='ivar'>@indentation</span> <span class='op'>=</span> <span class='int'>0</span>
|
503
475
|
<span class='ivar'>@indentation_string</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> </span><span class='tstring_end'>"</span></span>
|
504
|
-
<span class='ivar'>@stty</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Console</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>which stty</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
|
505
476
|
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='symbol'>:bovem</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
|
506
477
|
<span class='kw'>end</span>
|
478
|
+
|
479
|
+
<span class='comment'># Get the width of the terminal.
|
480
|
+
</span> <span class='comment'>#
|
481
|
+
</span> <span class='comment'># @return [Fixnum] The current width of the terminal. If not possible to retrieve the width, it returns `80.
|
482
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_line_width'>line_width</span>
|
483
|
+
<span class='kw'>begin</span>
|
484
|
+
<span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>io/console</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='op'>!</span><span class='kw'>defined?</span><span class='lparen'>(</span><span class='gvar'>$stdin</span><span class='period'>.</span><span class='id identifier rubyid_winsize'>winsize</span><span class='rparen'>)</span>
|
485
|
+
<span class='gvar'>$stdin</span><span class='period'>.</span><span class='id identifier rubyid_winsize'>winsize</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
|
486
|
+
<span class='kw'>rescue</span> <span class='const'>Exception</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
487
|
+
<span class='int'>80</span>
|
488
|
+
<span class='kw'>end</span>
|
489
|
+
<span class='kw'>end</span>
|
507
490
|
<span class='kw'>end</span></pre>
|
508
491
|
</td>
|
509
492
|
</tr>
|
@@ -554,41 +537,47 @@
|
|
554
537
|
<pre class="lines">
|
555
538
|
|
556
539
|
|
540
|
+
591
|
541
|
+
592
|
542
|
+
593
|
543
|
+
594
|
544
|
+
595
|
545
|
+
596
|
546
|
+
597
|
547
|
+
598
|
548
|
+
599
|
549
|
+
600
|
550
|
+
601
|
551
|
+
602
|
552
|
+
603
|
553
|
+
604
|
554
|
+
605
|
555
|
+
606
|
556
|
+
607
|
557
|
+
608
|
558
|
+
609
|
559
|
+
610
|
560
|
+
611
|
561
|
+
612
|
562
|
+
613
|
563
|
+
614
|
564
|
+
615
|
565
|
+
616
|
566
|
+
617
|
567
|
+
618
|
568
|
+
619
|
557
569
|
620
|
558
570
|
621
|
559
571
|
622
|
560
572
|
623
|
561
573
|
624
|
562
574
|
625
|
563
|
-
626
|
564
|
-
627
|
565
|
-
628
|
566
|
-
629
|
567
|
-
630
|
568
|
-
631
|
569
|
-
632
|
570
|
-
633
|
571
|
-
634
|
572
|
-
635
|
573
|
-
636
|
574
|
-
637
|
575
|
-
638
|
576
|
-
639
|
577
|
-
640
|
578
|
-
641
|
579
|
-
642
|
580
|
-
643
|
581
|
-
644
|
582
|
-
645
|
583
|
-
646
|
584
|
-
647</pre>
|
575
|
+
626</pre>
|
585
576
|
</td>
|
586
577
|
<td>
|
587
|
-
<pre class="code"><span class="info file"># File 'lib/bovem/console.rb', line
|
578
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/console.rb', line 591</span>
|
588
579
|
|
589
580
|
<span class='kw'>class</span> <span class='const'>Console</span>
|
590
|
-
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:line_width</span>
|
591
|
-
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:screen_width</span>
|
592
581
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:indentation</span>
|
593
582
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:indentation_string</span>
|
594
583
|
|
@@ -607,133 +596,39 @@
|
|
607
596
|
|
608
597
|
<span class='comment'># Initializes a new Console.
|
609
598
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
610
|
-
<span class='ivar'>@line_width</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_get_screen_width'>get_screen_width</span>
|
611
599
|
<span class='ivar'>@indentation</span> <span class='op'>=</span> <span class='int'>0</span>
|
612
600
|
<span class='ivar'>@indentation_string</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> </span><span class='tstring_end'>"</span></span>
|
613
|
-
<span class='ivar'>@stty</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Console</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>which stty</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
|
614
601
|
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='symbol'>:bovem</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
|
615
602
|
<span class='kw'>end</span>
|
603
|
+
|
604
|
+
<span class='comment'># Get the width of the terminal.
|
605
|
+
</span> <span class='comment'>#
|
606
|
+
</span> <span class='comment'># @return [Fixnum] The current width of the terminal. If not possible to retrieve the width, it returns `80.
|
607
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_line_width'>line_width</span>
|
608
|
+
<span class='kw'>begin</span>
|
609
|
+
<span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>io/console</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='op'>!</span><span class='kw'>defined?</span><span class='lparen'>(</span><span class='gvar'>$stdin</span><span class='period'>.</span><span class='id identifier rubyid_winsize'>winsize</span><span class='rparen'>)</span>
|
610
|
+
<span class='gvar'>$stdin</span><span class='period'>.</span><span class='id identifier rubyid_winsize'>winsize</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
|
611
|
+
<span class='kw'>rescue</span> <span class='const'>Exception</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
612
|
+
<span class='int'>80</span>
|
613
|
+
<span class='kw'>end</span>
|
614
|
+
<span class='kw'>end</span>
|
616
615
|
<span class='kw'>end</span></pre>
|
617
616
|
</td>
|
618
617
|
</tr>
|
619
618
|
</table>
|
620
619
|
</div>
|
621
620
|
|
622
|
-
|
623
|
-
<span id="line_width=-instance_method"></span>
|
624
|
-
<div class="method_details ">
|
625
|
-
<h3 class="signature " id="line_width-instance_method">
|
626
|
-
|
627
|
-
- (<tt>Fixnum</tt>) <strong>line_width</strong>
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
</h3><div class="docstring">
|
634
|
-
<div class="discussion">
|
635
|
-
<p>The line width. Default to <code>80</code>.</p>
|
636
|
-
|
637
|
-
|
638
621
|
</div>
|
639
|
-
</div>
|
640
|
-
<div class="tags">
|
641
|
-
|
642
|
-
<p class="tag_title">Returns:</p>
|
643
|
-
<ul class="return">
|
644
|
-
|
645
|
-
<li>
|
646
|
-
|
647
|
-
|
648
|
-
<span class='type'>(<tt>Fixnum</tt>)</span>
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
—
|
653
|
-
<div class='inline'><p>The line width. Default to <code>80</code>.</p>
|
654
|
-
</div>
|
655
|
-
|
656
|
-
</li>
|
657
|
-
|
658
|
-
</ul>
|
659
|
-
|
660
|
-
</div><table class="source_code">
|
661
|
-
<tr>
|
662
|
-
<td>
|
663
|
-
<pre class="lines">
|
664
|
-
|
665
|
-
|
666
|
-
620
|
667
|
-
621
|
668
|
-
622
|
669
|
-
623
|
670
|
-
624
|
671
|
-
625
|
672
|
-
626
|
673
|
-
627
|
674
|
-
628
|
675
|
-
629
|
676
|
-
630
|
677
|
-
631
|
678
|
-
632
|
679
|
-
633
|
680
|
-
634
|
681
|
-
635
|
682
|
-
636
|
683
|
-
637
|
684
|
-
638
|
685
|
-
639
|
686
|
-
640
|
687
|
-
641
|
688
|
-
642
|
689
|
-
643
|
690
|
-
644
|
691
|
-
645
|
692
|
-
646
|
693
|
-
647</pre>
|
694
|
-
</td>
|
695
|
-
<td>
|
696
|
-
<pre class="code"><span class="info file"># File 'lib/bovem/console.rb', line 620</span>
|
697
622
|
|
698
|
-
<span class='kw'>class</span> <span class='const'>Console</span>
|
699
|
-
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:line_width</span>
|
700
|
-
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:screen_width</span>
|
701
|
-
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:indentation</span>
|
702
|
-
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:indentation_string</span>
|
703
623
|
|
704
|
-
<
|
705
|
-
|
706
|
-
<span class='id identifier rubyid_include'>include</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>ConsoleMethods</span><span class='op'>::</span><span class='const'>Output</span>
|
707
|
-
<span class='id identifier rubyid_include'>include</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>ConsoleMethods</span><span class='op'>::</span><span class='const'>Logging</span>
|
708
|
-
<span class='id identifier rubyid_include'>include</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>ConsoleMethods</span><span class='op'>::</span><span class='const'>Interactions</span>
|
709
|
-
|
710
|
-
<span class='comment'># Returns a unique instance for Console.
|
711
|
-
</span> <span class='comment'>#
|
712
|
-
</span> <span class='comment'># @return [Console] A new instance.
|
713
|
-
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
|
714
|
-
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='op'>::</span><span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Console</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
715
|
-
<span class='kw'>end</span>
|
624
|
+
<div id="class_method_details" class="method_details_list">
|
625
|
+
<h2>Class Method Details</h2>
|
716
626
|
|
717
|
-
<span class='comment'># Initializes a new Console.
|
718
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
719
|
-
<span class='ivar'>@line_width</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_get_screen_width'>get_screen_width</span>
|
720
|
-
<span class='ivar'>@indentation</span> <span class='op'>=</span> <span class='int'>0</span>
|
721
|
-
<span class='ivar'>@indentation_string</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> </span><span class='tstring_end'>"</span></span>
|
722
|
-
<span class='ivar'>@stty</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Console</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>which stty</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
|
723
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='symbol'>:bovem</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
|
724
|
-
<span class='kw'>end</span>
|
725
|
-
<span class='kw'>end</span></pre>
|
726
|
-
</td>
|
727
|
-
</tr>
|
728
|
-
</table>
|
729
|
-
</div>
|
730
627
|
|
731
|
-
|
732
|
-
|
733
|
-
<div class="method_details ">
|
734
|
-
<h3 class="signature " id="screen_width-instance_method">
|
628
|
+
<div class="method_details first">
|
629
|
+
<h3 class="signature first" id="instance-class_method">
|
735
630
|
|
736
|
-
|
631
|
+
+ (<tt><span class='object_link'><a href="" title="Bovem::Console (class)">Console</a></span></tt>) <strong>instance</strong>
|
737
632
|
|
738
633
|
|
739
634
|
|
@@ -741,7 +636,7 @@
|
|
741
636
|
|
742
637
|
</h3><div class="docstring">
|
743
638
|
<div class="discussion">
|
744
|
-
<p>
|
639
|
+
<p>Returns a unique instance for Console.</p>
|
745
640
|
|
746
641
|
|
747
642
|
</div>
|
@@ -754,12 +649,12 @@
|
|
754
649
|
<li>
|
755
650
|
|
756
651
|
|
757
|
-
<span class='type'>(<tt>
|
652
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="Bovem::Console (class)">Console</a></span></tt>)</span>
|
758
653
|
|
759
654
|
|
760
655
|
|
761
656
|
—
|
762
|
-
<div class='inline'><p>
|
657
|
+
<div class='inline'><p>A new instance.</p>
|
763
658
|
</div>
|
764
659
|
|
765
660
|
</li>
|
@@ -772,65 +667,15 @@
|
|
772
667
|
<pre class="lines">
|
773
668
|
|
774
669
|
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
623
|
779
|
-
624
|
780
|
-
625
|
781
|
-
626
|
782
|
-
627
|
783
|
-
628
|
784
|
-
629
|
785
|
-
630
|
786
|
-
631
|
787
|
-
632
|
788
|
-
633
|
789
|
-
634
|
790
|
-
635
|
791
|
-
636
|
792
|
-
637
|
793
|
-
638
|
794
|
-
639
|
795
|
-
640
|
796
|
-
641
|
797
|
-
642
|
798
|
-
643
|
799
|
-
644
|
800
|
-
645
|
801
|
-
646
|
802
|
-
647</pre>
|
670
|
+
604
|
671
|
+
605
|
672
|
+
606</pre>
|
803
673
|
</td>
|
804
674
|
<td>
|
805
|
-
<pre class="code"><span class="info file"># File 'lib/bovem/console.rb', line
|
806
|
-
|
807
|
-
<span class='kw'>class</span> <span class='const'>Console</span>
|
808
|
-
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:line_width</span>
|
809
|
-
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:screen_width</span>
|
810
|
-
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:indentation</span>
|
811
|
-
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:indentation_string</span>
|
812
|
-
|
813
|
-
<span class='id identifier rubyid_include'>include</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span>
|
814
|
-
<span class='id identifier rubyid_include'>include</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>ConsoleMethods</span><span class='op'>::</span><span class='const'>StyleHandling</span>
|
815
|
-
<span class='id identifier rubyid_include'>include</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>ConsoleMethods</span><span class='op'>::</span><span class='const'>Output</span>
|
816
|
-
<span class='id identifier rubyid_include'>include</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>ConsoleMethods</span><span class='op'>::</span><span class='const'>Logging</span>
|
817
|
-
<span class='id identifier rubyid_include'>include</span> <span class='const'>Bovem</span><span class='op'>::</span><span class='const'>ConsoleMethods</span><span class='op'>::</span><span class='const'>Interactions</span>
|
675
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/console.rb', line 604</span>
|
818
676
|
|
819
|
-
|
820
|
-
</span>
|
821
|
-
</span> <span class='comment'># @return [Console] A new instance.
|
822
|
-
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
|
823
|
-
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='op'>::</span><span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Console</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
824
|
-
<span class='kw'>end</span>
|
825
|
-
|
826
|
-
<span class='comment'># Initializes a new Console.
|
827
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
828
|
-
<span class='ivar'>@line_width</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_get_screen_width'>get_screen_width</span>
|
829
|
-
<span class='ivar'>@indentation</span> <span class='op'>=</span> <span class='int'>0</span>
|
830
|
-
<span class='ivar'>@indentation_string</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> </span><span class='tstring_end'>"</span></span>
|
831
|
-
<span class='ivar'>@stty</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Console</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>which stty</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
|
832
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='symbol'>:bovem</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</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='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
|
833
|
-
<span class='kw'>end</span>
|
677
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
|
678
|
+
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='op'>::</span><span class='const'>Bovem</span><span class='op'>::</span><span class='const'>Console</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
834
679
|
<span class='kw'>end</span></pre>
|
835
680
|
</td>
|
836
681
|
</tr>
|
@@ -839,15 +684,14 @@
|
|
839
684
|
|
840
685
|
</div>
|
841
686
|
|
842
|
-
|
843
|
-
|
844
|
-
<h2>Class Method Details</h2>
|
687
|
+
<div id="instance_method_details" class="method_details_list">
|
688
|
+
<h2>Instance Method Details</h2>
|
845
689
|
|
846
690
|
|
847
691
|
<div class="method_details first">
|
848
|
-
<h3 class="signature first" id="
|
692
|
+
<h3 class="signature first" id="line_width-instance_method">
|
849
693
|
|
850
|
-
|
694
|
+
- (<tt>Fixnum</tt>) <strong>line_width</strong>
|
851
695
|
|
852
696
|
|
853
697
|
|
@@ -855,7 +699,7 @@
|
|
855
699
|
|
856
700
|
</h3><div class="docstring">
|
857
701
|
<div class="discussion">
|
858
|
-
<p>
|
702
|
+
<p>Get the width of the terminal.</p>
|
859
703
|
|
860
704
|
|
861
705
|
</div>
|
@@ -868,12 +712,12 @@
|
|
868
712
|
<li>
|
869
713
|
|
870
714
|
|
871
|
-
<span class='type'>(<tt
|
715
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
872
716
|
|
873
717
|
|
874
718
|
|
875
719
|
—
|
876
|
-
<div class='inline'><p>
|
720
|
+
<div class='inline'><p>The current width of the terminal. If not possible to retrieve the width, it returns `80.</p>
|
877
721
|
</div>
|
878
722
|
|
879
723
|
</li>
|
@@ -886,15 +730,25 @@
|
|
886
730
|
<pre class="lines">
|
887
731
|
|
888
732
|
|
889
|
-
|
890
|
-
|
891
|
-
|
733
|
+
618
|
734
|
+
619
|
735
|
+
620
|
736
|
+
621
|
737
|
+
622
|
738
|
+
623
|
739
|
+
624
|
740
|
+
625</pre>
|
892
741
|
</td>
|
893
742
|
<td>
|
894
|
-
<pre class="code"><span class="info file"># File 'lib/bovem/console.rb', line
|
895
|
-
|
896
|
-
<span class='kw'>def</span> <span class='
|
897
|
-
<span class='
|
743
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/console.rb', line 618</span>
|
744
|
+
|
745
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_line_width'>line_width</span>
|
746
|
+
<span class='kw'>begin</span>
|
747
|
+
<span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>io/console</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='op'>!</span><span class='kw'>defined?</span><span class='lparen'>(</span><span class='gvar'>$stdin</span><span class='period'>.</span><span class='id identifier rubyid_winsize'>winsize</span><span class='rparen'>)</span>
|
748
|
+
<span class='gvar'>$stdin</span><span class='period'>.</span><span class='id identifier rubyid_winsize'>winsize</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
|
749
|
+
<span class='kw'>rescue</span> <span class='const'>Exception</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
750
|
+
<span class='int'>80</span>
|
751
|
+
<span class='kw'>end</span>
|
898
752
|
<span class='kw'>end</span></pre>
|
899
753
|
</td>
|
900
754
|
</tr>
|
@@ -906,9 +760,9 @@
|
|
906
760
|
</div>
|
907
761
|
|
908
762
|
<div id="footer">
|
909
|
-
Generated on
|
763
|
+
Generated on Tue Feb 5 13:31:47 2013 by
|
910
764
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
911
|
-
0.8.
|
765
|
+
0.8.4 (ruby-1.9.3).
|
912
766
|
</div>
|
913
767
|
|
914
768
|
</body>
|