bovem 1.2.6 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +1 -1
- data/Gemfile +1 -1
- data/README.md +5 -2
- data/bovem.gemspec +11 -9
- data/doc/Bovem.html +7 -25
- data/doc/Bovem/Configuration.html +30 -43
- data/doc/Bovem/Console.html +225 -4360
- data/doc/Bovem/ConsoleMethods.html +125 -0
- data/doc/Bovem/ConsoleMethods/Interactions.html +575 -0
- data/doc/Bovem/ConsoleMethods/Interactions/ClassMethods.html +231 -0
- data/doc/Bovem/ConsoleMethods/Logging.html +2218 -0
- data/doc/Bovem/ConsoleMethods/Logging/ClassMethods.html +212 -0
- data/doc/Bovem/ConsoleMethods/Output.html +1213 -0
- data/doc/Bovem/ConsoleMethods/StyleHandling.html +274 -0
- data/doc/Bovem/ConsoleMethods/StyleHandling/ClassMethods.html +653 -0
- 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 +112 -12
- data/doc/Bovem/Shell.html +58 -1888
- data/doc/Bovem/ShellMethods.html +125 -0
- data/doc/Bovem/ShellMethods/Directories.html +484 -0
- data/doc/Bovem/ShellMethods/Execute.html +565 -0
- data/doc/Bovem/ShellMethods/General.html +450 -0
- data/doc/Bovem/ShellMethods/Read.html +451 -0
- data/doc/Bovem/ShellMethods/Write.html +676 -0
- data/doc/Bovem/Version.html +6 -6
- data/doc/_index.html +145 -4
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +10 -7
- data/doc/frames.html +1 -1
- data/doc/index.html +10 -7
- data/doc/method_list.html +119 -79
- data/doc/top-level-namespace.html +3 -3
- data/lib/bovem.rb +1 -1
- data/lib/bovem/configuration.rb +24 -13
- data/lib/bovem/console.rb +566 -497
- data/lib/bovem/errors.rb +1 -1
- data/lib/bovem/logger.rb +4 -4
- data/lib/bovem/shell.rb +482 -305
- data/lib/bovem/version.rb +4 -4
- data/locales/en.yml +43 -0
- data/locales/it.yml +43 -0
- data/spec/bovem/configuration_spec.rb +3 -3
- data/spec/bovem/console_spec.rb +17 -10
- data/spec/bovem/logger_spec.rb +1 -1
- data/spec/bovem/shell_spec.rb +9 -5
- data/spec/coverage_helper.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +32 -22
@@ -0,0 +1,212 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: Bovem::ConsoleMethods::Logging::ClassMethods
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.3
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../../../';
|
20
|
+
framesUrl = "../../../frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../../../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../../../_index.html">Index (C)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../../../Bovem.html" title="Bovem (module)">Bovem</a></span></span> » <span class='title'><span class='object_link'><a href="../../ConsoleMethods.html" title="Bovem::ConsoleMethods (module)">ConsoleMethods</a></span></span> » <span class='title'><span class='object_link'><a href="../Logging.html" title="Bovem::ConsoleMethods::Logging (module)">Logging</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">ClassMethods</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../../../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../../../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../../../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Module: Bovem::ConsoleMethods::Logging::ClassMethods
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
82
|
+
<dd class="r1 last">lib/bovem/console.rb</dd>
|
83
|
+
|
84
|
+
</dl>
|
85
|
+
<div class="clear"></div>
|
86
|
+
|
87
|
+
<h2>Overview</h2><div class="docstring">
|
88
|
+
<div class="discussion">
|
89
|
+
<p>Class methods for logging activities to the user.</p>
|
90
|
+
|
91
|
+
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
<div class="tags">
|
95
|
+
|
96
|
+
|
97
|
+
</div>
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
<h2>
|
106
|
+
Instance Method Summary
|
107
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
108
|
+
</h2>
|
109
|
+
|
110
|
+
<ul class="summary">
|
111
|
+
|
112
|
+
<li class="public ">
|
113
|
+
<span class="summary_signature">
|
114
|
+
|
115
|
+
<a href="#min_banner_length-instance_method" title="#min_banner_length (instance method)">- (Fixnum) <strong>min_banner_length</strong> </a>
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
</span>
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
<span class="summary_desc"><div class='inline'><p>Returns the minimum length of a banner, not including brackets and leading spaces.</p>
|
130
|
+
</div></span>
|
131
|
+
|
132
|
+
</li>
|
133
|
+
|
134
|
+
|
135
|
+
</ul>
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
<div id="instance_method_details" class="method_details_list">
|
141
|
+
<h2>Instance Method Details</h2>
|
142
|
+
|
143
|
+
|
144
|
+
<div class="method_details first">
|
145
|
+
<h3 class="signature first" id="min_banner_length-instance_method">
|
146
|
+
|
147
|
+
- (<tt>Fixnum</tt>) <strong>min_banner_length</strong>
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
</h3><div class="docstring">
|
154
|
+
<div class="discussion">
|
155
|
+
<p>Returns the minimum length of a banner, not including brackets and leading spaces.</p>
|
156
|
+
|
157
|
+
|
158
|
+
</div>
|
159
|
+
</div>
|
160
|
+
<div class="tags">
|
161
|
+
|
162
|
+
<p class="tag_title">Returns:</p>
|
163
|
+
<ul class="return">
|
164
|
+
|
165
|
+
<li>
|
166
|
+
|
167
|
+
|
168
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
—
|
173
|
+
<div class='inline'><p>The minimum length of a banner.</p>
|
174
|
+
</div>
|
175
|
+
|
176
|
+
</li>
|
177
|
+
|
178
|
+
</ul>
|
179
|
+
|
180
|
+
</div><table class="source_code">
|
181
|
+
<tr>
|
182
|
+
<td>
|
183
|
+
<pre class="lines">
|
184
|
+
|
185
|
+
|
186
|
+
256
|
187
|
+
257
|
188
|
+
258</pre>
|
189
|
+
</td>
|
190
|
+
<td>
|
191
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/console.rb', line 256</span>
|
192
|
+
|
193
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_min_banner_length'>min_banner_length</span>
|
194
|
+
<span class='int'>1</span>
|
195
|
+
<span class='kw'>end</span></pre>
|
196
|
+
</td>
|
197
|
+
</tr>
|
198
|
+
</table>
|
199
|
+
</div>
|
200
|
+
|
201
|
+
</div>
|
202
|
+
|
203
|
+
</div>
|
204
|
+
|
205
|
+
<div id="footer">
|
206
|
+
Generated on Fri Feb 1 23:40:18 2013 by
|
207
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
208
|
+
0.8.3 (ruby-1.9.3).
|
209
|
+
</div>
|
210
|
+
|
211
|
+
</body>
|
212
|
+
</html>
|
@@ -0,0 +1,1213 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: Bovem::ConsoleMethods::Output
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.3
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../../';
|
20
|
+
framesUrl = "../../frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../../_index.html">Index (O)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../../Bovem.html" title="Bovem (module)">Bovem</a></span></span> » <span class='title'><span class='object_link'><a href="../ConsoleMethods.html" title="Bovem::ConsoleMethods (module)">ConsoleMethods</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Output</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Module: Bovem::ConsoleMethods::Output
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
<dt class="r1">Included in:</dt>
|
81
|
+
<dd class="r1"><span class='object_link'><a href="../Console.html" title="Bovem::Console (class)">Bovem::Console</a></span></dd>
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
<dt class="r2 last">Defined in:</dt>
|
86
|
+
<dd class="r2 last">lib/bovem/console.rb</dd>
|
87
|
+
|
88
|
+
</dl>
|
89
|
+
<div class="clear"></div>
|
90
|
+
|
91
|
+
<h2>Overview</h2><div class="docstring">
|
92
|
+
<div class="discussion">
|
93
|
+
<p>Methods for formatting output messages.</p>
|
94
|
+
|
95
|
+
|
96
|
+
</div>
|
97
|
+
</div>
|
98
|
+
<div class="tags">
|
99
|
+
|
100
|
+
|
101
|
+
</div>
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
<h2>
|
110
|
+
Instance Method Summary
|
111
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
112
|
+
</h2>
|
113
|
+
|
114
|
+
<ul class="summary">
|
115
|
+
|
116
|
+
<li class="public ">
|
117
|
+
<span class="summary_signature">
|
118
|
+
|
119
|
+
<a href="#format-instance_method" title="#format (instance method)">- (String) <strong>format</strong>(message, suffix = "\n", indent = true, wrap = true, plain = false) </a>
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
</span>
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<span class="summary_desc"><div class='inline'><p>Formats a message.</p>
|
134
|
+
</div></span>
|
135
|
+
|
136
|
+
</li>
|
137
|
+
|
138
|
+
|
139
|
+
<li class="public ">
|
140
|
+
<span class="summary_signature">
|
141
|
+
|
142
|
+
<a href="#format_right-instance_method" title="#format_right (instance method)">- (String) <strong>format_right</strong>(message, width = true, go_up = true, plain = false) </a>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
</span>
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
<span class="summary_desc"><div class='inline'><p>Formats a message to be written right-aligned.</p>
|
157
|
+
</div></span>
|
158
|
+
|
159
|
+
</li>
|
160
|
+
|
161
|
+
|
162
|
+
<li class="public ">
|
163
|
+
<span class="summary_signature">
|
164
|
+
|
165
|
+
<a href="#get_screen_width-instance_method" title="#get_screen_width (instance method)">- (Fixnum) <strong>get_screen_width</strong> </a>
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
</span>
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
<span class="summary_desc"><div class='inline'><p>Gets the current screen width.</p>
|
180
|
+
</div></span>
|
181
|
+
|
182
|
+
</li>
|
183
|
+
|
184
|
+
|
185
|
+
<li class="public ">
|
186
|
+
<span class="summary_signature">
|
187
|
+
|
188
|
+
<a href="#indent-instance_method" title="#indent (instance method)">- (String) <strong>indent</strong>(message, width = true, newline_separator = "\n") </a>
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
</span>
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
<span class="summary_desc"><div class='inline'><p>Indents a message.</p>
|
203
|
+
</div></span>
|
204
|
+
|
205
|
+
</li>
|
206
|
+
|
207
|
+
|
208
|
+
<li class="public ">
|
209
|
+
<span class="summary_signature">
|
210
|
+
|
211
|
+
<a href="#reset_indentation-instance_method" title="#reset_indentation (instance method)">- (Fixnum) <strong>reset_indentation</strong> </a>
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
</span>
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
<span class="summary_desc"><div class='inline'><p>Resets indentation width to <code>0</code>.</p>
|
226
|
+
</div></span>
|
227
|
+
|
228
|
+
</li>
|
229
|
+
|
230
|
+
|
231
|
+
<li class="public ">
|
232
|
+
<span class="summary_signature">
|
233
|
+
|
234
|
+
<a href="#set_indentation-instance_method" title="#set_indentation (instance method)">- (Fixnum) <strong>set_indentation</strong>(width, is_absolute = false) </a>
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
</span>
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
<span class="summary_desc"><div class='inline'><p>Sets the new indentation width.</p>
|
249
|
+
</div></span>
|
250
|
+
|
251
|
+
</li>
|
252
|
+
|
253
|
+
|
254
|
+
<li class="public ">
|
255
|
+
<span class="summary_signature">
|
256
|
+
|
257
|
+
<a href="#with_indentation-instance_method" title="#with_indentation (instance method)">- (Fixnum) <strong>with_indentation</strong>(width = 3, is_absolute = false) </a>
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
</span>
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
<span class="summary_desc"><div class='inline'><p>Starts a indented region of text.</p>
|
272
|
+
</div></span>
|
273
|
+
|
274
|
+
</li>
|
275
|
+
|
276
|
+
|
277
|
+
<li class="public ">
|
278
|
+
<span class="summary_signature">
|
279
|
+
|
280
|
+
<a href="#wrap-instance_method" title="#wrap (instance method)">- (String) <strong>wrap</strong>(message, width = nil) </a>
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
</span>
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
<span class="summary_desc"><div class='inline'><p>Wraps a message in fixed line width.</p>
|
295
|
+
</div></span>
|
296
|
+
|
297
|
+
</li>
|
298
|
+
|
299
|
+
|
300
|
+
</ul>
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
<div id="instance_method_details" class="method_details_list">
|
306
|
+
<h2>Instance Method Details</h2>
|
307
|
+
|
308
|
+
|
309
|
+
<div class="method_details first">
|
310
|
+
<h3 class="signature first" id="format-instance_method">
|
311
|
+
|
312
|
+
- (<tt>String</tt>) <strong>format</strong>(message, suffix = "\n", indent = true, wrap = true, plain = false)
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
|
318
|
+
</h3><div class="docstring">
|
319
|
+
<div class="discussion">
|
320
|
+
<p>Formats a message.</p>
|
321
|
+
|
322
|
+
<p>You can style text by using <code>{mark}</code> and <code>{/mark}</code> syntax.</p>
|
323
|
+
|
324
|
+
|
325
|
+
</div>
|
326
|
+
</div>
|
327
|
+
<div class="tags">
|
328
|
+
<p class="tag_title">Parameters:</p>
|
329
|
+
<ul class="param">
|
330
|
+
|
331
|
+
<li>
|
332
|
+
|
333
|
+
<span class='name'>message</span>
|
334
|
+
|
335
|
+
|
336
|
+
<span class='type'>(<tt>String</tt>)</span>
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
—
|
341
|
+
<div class='inline'><p>The message to format.</p>
|
342
|
+
</div>
|
343
|
+
|
344
|
+
</li>
|
345
|
+
|
346
|
+
<li>
|
347
|
+
|
348
|
+
<span class='name'>suffix</span>
|
349
|
+
|
350
|
+
|
351
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
352
|
+
|
353
|
+
|
354
|
+
<em class="default">(defaults to: <tt>"\n"</tt>)</em>
|
355
|
+
|
356
|
+
|
357
|
+
—
|
358
|
+
<div class='inline'><p>If not <code>nil</code> or <code>false</code>, a suffix to add to the message. <code>true</code> means to add <code>\n</code>.</p>
|
359
|
+
</div>
|
360
|
+
|
361
|
+
</li>
|
362
|
+
|
363
|
+
<li>
|
364
|
+
|
365
|
+
<span class='name'>indent</span>
|
366
|
+
|
367
|
+
|
368
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
369
|
+
|
370
|
+
|
371
|
+
<em class="default">(defaults to: <tt>true</tt>)</em>
|
372
|
+
|
373
|
+
|
374
|
+
—
|
375
|
+
<div class='inline'><p>If not <code>nil</code> or <code>false</code>, the width to use for indentation. <code>true</code> means to use the current indentation, a negative value of <code>-x</code> will indent of <code>x</code> absolute spaces.</p>
|
376
|
+
</div>
|
377
|
+
|
378
|
+
</li>
|
379
|
+
|
380
|
+
<li>
|
381
|
+
|
382
|
+
<span class='name'>wrap</span>
|
383
|
+
|
384
|
+
|
385
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
386
|
+
|
387
|
+
|
388
|
+
<em class="default">(defaults to: <tt>true</tt>)</em>
|
389
|
+
|
390
|
+
|
391
|
+
—
|
392
|
+
<div class='inline'><p>If not <code>nil</code> or <code>false</code>, the maximum length of a line. <code>true</code> means the current line width.</p>
|
393
|
+
</div>
|
394
|
+
|
395
|
+
</li>
|
396
|
+
|
397
|
+
<li>
|
398
|
+
|
399
|
+
<span class='name'>plain</span>
|
400
|
+
|
401
|
+
|
402
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
403
|
+
|
404
|
+
|
405
|
+
<em class="default">(defaults to: <tt>false</tt>)</em>
|
406
|
+
|
407
|
+
|
408
|
+
—
|
409
|
+
<div class='inline'><p>If ignore color markers into the message.</p>
|
410
|
+
</div>
|
411
|
+
|
412
|
+
</li>
|
413
|
+
|
414
|
+
</ul>
|
415
|
+
|
416
|
+
<p class="tag_title">Returns:</p>
|
417
|
+
<ul class="return">
|
418
|
+
|
419
|
+
<li>
|
420
|
+
|
421
|
+
|
422
|
+
<span class='type'>(<tt>String</tt>)</span>
|
423
|
+
|
424
|
+
|
425
|
+
|
426
|
+
—
|
427
|
+
<div class='inline'><p>The formatted message.</p>
|
428
|
+
</div>
|
429
|
+
|
430
|
+
</li>
|
431
|
+
|
432
|
+
</ul>
|
433
|
+
|
434
|
+
<p class="tag_title">See Also:</p>
|
435
|
+
<ul class="see">
|
436
|
+
|
437
|
+
<li>#replace_markers</li>
|
438
|
+
|
439
|
+
</ul>
|
440
|
+
|
441
|
+
</div><table class="source_code">
|
442
|
+
<tr>
|
443
|
+
<td>
|
444
|
+
<pre class="lines">
|
445
|
+
|
446
|
+
|
447
|
+
201
|
448
|
+
202
|
449
|
+
203
|
450
|
+
204
|
451
|
+
205
|
452
|
+
206
|
453
|
+
207
|
454
|
+
208
|
455
|
+
209
|
456
|
+
210
|
457
|
+
211
|
458
|
+
212
|
459
|
+
213
|
460
|
+
214
|
461
|
+
215
|
462
|
+
216
|
463
|
+
217
|
464
|
+
218
|
465
|
+
219
|
466
|
+
220
|
467
|
+
221
|
468
|
+
222
|
469
|
+
223</pre>
|
470
|
+
</td>
|
471
|
+
<td>
|
472
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/console.rb', line 201</span>
|
473
|
+
|
474
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_format'>format</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span><span class='comma'>,</span> <span class='id identifier rubyid_suffix'>suffix</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_indent'>indent</span> <span class='op'>=</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='id identifier rubyid_wrap'>wrap</span> <span class='op'>=</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='id identifier rubyid_plain'>plain</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
475
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_message'>message</span>
|
476
|
+
|
477
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_rv'>rv</span><span class='comma'>,</span> <span class='id identifier rubyid_plain'>plain</span><span class='rparen'>)</span> <span class='comment'># Replace markers
|
478
|
+
</span>
|
479
|
+
<span class='comment'># Compute the real width available for the screen, if we both indent and wrap
|
480
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_wrap'>wrap</span> <span class='op'>==</span> <span class='kw'>true</span> <span class='kw'>then</span>
|
481
|
+
<span class='id identifier rubyid_wrap'>wrap</span> <span class='op'>=</span> <span class='ivar'>@line_width</span>
|
482
|
+
|
483
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_indent'>indent</span> <span class='op'>==</span> <span class='kw'>true</span> <span class='kw'>then</span>
|
484
|
+
<span class='id identifier rubyid_wrap'>wrap</span> <span class='op'>-=</span> <span class='ivar'>@indentation</span>
|
485
|
+
<span class='kw'>else</span>
|
486
|
+
<span class='id identifier rubyid_indent_i'>indent_i</span> <span class='op'>=</span> <span class='id identifier rubyid_indent'>indent</span><span class='period'>.</span><span class='id identifier rubyid_to_integer'>to_integer</span>
|
487
|
+
<span class='id identifier rubyid_wrap'>wrap</span> <span class='op'>-=</span> <span class='lparen'>(</span><span class='id identifier rubyid_indent_i'>indent_i</span> <span class='op'>></span> <span class='int'>0</span> <span class='op'>?</span> <span class='ivar'>@indentation</span> <span class='op'>:</span> <span class='int'>0</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='id identifier rubyid_indent_i'>indent_i</span>
|
488
|
+
<span class='kw'>end</span>
|
489
|
+
<span class='kw'>end</span>
|
490
|
+
|
491
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_wrap'>wrap</span><span class='lparen'>(</span><span class='id identifier rubyid_rv'>rv</span><span class='comma'>,</span> <span class='id identifier rubyid_wrap'>wrap</span><span class='rparen'>)</span> <span class='comment'># Wrap
|
492
|
+
</span> <span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_indent'>indent</span><span class='lparen'>(</span><span class='id identifier rubyid_rv'>rv</span><span class='comma'>,</span> <span class='id identifier rubyid_indent'>indent</span><span class='rparen'>)</span> <span class='comment'># Indent
|
493
|
+
</span>
|
494
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>+=</span> <span class='id identifier rubyid_suffix'>suffix</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span> <span class='kw'>if</span> <span class='id identifier rubyid_suffix'>suffix</span> <span class='comment'># Add the suffix
|
495
|
+
</span> <span class='id identifier rubyid_rv'>rv</span>
|
496
|
+
<span class='kw'>end</span></pre>
|
497
|
+
</td>
|
498
|
+
</tr>
|
499
|
+
</table>
|
500
|
+
</div>
|
501
|
+
|
502
|
+
<div class="method_details ">
|
503
|
+
<h3 class="signature " id="format_right-instance_method">
|
504
|
+
|
505
|
+
- (<tt>String</tt>) <strong>format_right</strong>(message, width = true, go_up = true, plain = false)
|
506
|
+
|
507
|
+
|
508
|
+
|
509
|
+
|
510
|
+
|
511
|
+
</h3><div class="docstring">
|
512
|
+
<div class="discussion">
|
513
|
+
<p>Formats a message to be written right-aligned.</p>
|
514
|
+
|
515
|
+
|
516
|
+
</div>
|
517
|
+
</div>
|
518
|
+
<div class="tags">
|
519
|
+
<p class="tag_title">Parameters:</p>
|
520
|
+
<ul class="param">
|
521
|
+
|
522
|
+
<li>
|
523
|
+
|
524
|
+
<span class='name'>message</span>
|
525
|
+
|
526
|
+
|
527
|
+
<span class='type'>(<tt>String</tt>)</span>
|
528
|
+
|
529
|
+
|
530
|
+
|
531
|
+
—
|
532
|
+
<div class='inline'><p>The message to format.</p>
|
533
|
+
</div>
|
534
|
+
|
535
|
+
</li>
|
536
|
+
|
537
|
+
<li>
|
538
|
+
|
539
|
+
<span class='name'>width</span>
|
540
|
+
|
541
|
+
|
542
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
543
|
+
|
544
|
+
|
545
|
+
<em class="default">(defaults to: <tt>true</tt>)</em>
|
546
|
+
|
547
|
+
|
548
|
+
—
|
549
|
+
<div class='inline'><p>The screen width. If <code>true</code>, it is automatically computed.</p>
|
550
|
+
</div>
|
551
|
+
|
552
|
+
</li>
|
553
|
+
|
554
|
+
<li>
|
555
|
+
|
556
|
+
<span class='name'>go_up</span>
|
557
|
+
|
558
|
+
|
559
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
560
|
+
|
561
|
+
|
562
|
+
<em class="default">(defaults to: <tt>true</tt>)</em>
|
563
|
+
|
564
|
+
|
565
|
+
—
|
566
|
+
<div class='inline'><p>If go up one line before formatting.</p>
|
567
|
+
</div>
|
568
|
+
|
569
|
+
</li>
|
570
|
+
|
571
|
+
<li>
|
572
|
+
|
573
|
+
<span class='name'>plain</span>
|
574
|
+
|
575
|
+
|
576
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
577
|
+
|
578
|
+
|
579
|
+
<em class="default">(defaults to: <tt>false</tt>)</em>
|
580
|
+
|
581
|
+
|
582
|
+
—
|
583
|
+
<div class='inline'><p>If ignore color markers into the message.</p>
|
584
|
+
</div>
|
585
|
+
|
586
|
+
</li>
|
587
|
+
|
588
|
+
</ul>
|
589
|
+
|
590
|
+
<p class="tag_title">Returns:</p>
|
591
|
+
<ul class="return">
|
592
|
+
|
593
|
+
<li>
|
594
|
+
|
595
|
+
|
596
|
+
<span class='type'>(<tt>String</tt>)</span>
|
597
|
+
|
598
|
+
|
599
|
+
|
600
|
+
—
|
601
|
+
<div class='inline'><p>The formatted message.</p>
|
602
|
+
</div>
|
603
|
+
|
604
|
+
</li>
|
605
|
+
|
606
|
+
</ul>
|
607
|
+
|
608
|
+
</div><table class="source_code">
|
609
|
+
<tr>
|
610
|
+
<td>
|
611
|
+
<pre class="lines">
|
612
|
+
|
613
|
+
|
614
|
+
232
|
615
|
+
233
|
616
|
+
234
|
617
|
+
235
|
618
|
+
236
|
619
|
+
237
|
620
|
+
238
|
621
|
+
239
|
622
|
+
240
|
623
|
+
241
|
624
|
+
242
|
625
|
+
243
|
626
|
+
244
|
627
|
+
245</pre>
|
628
|
+
</td>
|
629
|
+
<td>
|
630
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/console.rb', line 232</span>
|
631
|
+
|
632
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_format_right'>format_right</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span><span class='comma'>,</span> <span class='id identifier rubyid_width'>width</span> <span class='op'>=</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='id identifier rubyid_go_up'>go_up</span> <span class='op'>=</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='id identifier rubyid_plain'>plain</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
633
|
+
<span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_replace_markers'>replace_markers</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span><span class='comma'>,</span> <span class='id identifier rubyid_plain'>plain</span><span class='rparen'>)</span>
|
634
|
+
|
635
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_go_up'>go_up</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\e[A</span><span class='tstring_end'>"</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span>
|
636
|
+
|
637
|
+
<span class='ivar'>@screen_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>
|
638
|
+
<span class='id identifier rubyid_width'>width</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_width'>width</span> <span class='op'>==</span> <span class='kw'>true</span> <span class='op'>||</span> <span class='id identifier rubyid_width'>width</span><span class='period'>.</span><span class='id identifier rubyid_to_integer'>to_integer</span> <span class='op'><</span> <span class='int'>1</span> <span class='op'>?</span> <span class='ivar'>@screen_width</span> <span class='op'>:</span> <span class='id identifier rubyid_width'>width</span><span class='period'>.</span><span class='id identifier rubyid_to_integer'>to_integer</span><span class='rparen'>)</span>
|
639
|
+
|
640
|
+
<span class='comment'># Get padding
|
641
|
+
</span> <span class='id identifier rubyid_padding'>padding</span> <span class='op'>=</span> <span class='id identifier rubyid_width'>width</span> <span class='op'>-</span> <span class='id identifier rubyid_message'>message</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>(\e\[[0-9]*[a-z]?)|(\\n)</span><span class='regexp_end'>/i</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span>
|
642
|
+
|
643
|
+
<span class='comment'># Return
|
644
|
+
</span> <span class='id identifier rubyid_rv'>rv</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\e[0G\e[</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_padding'>padding</span><span class='rbrace'>}</span><span class='tstring_content'>C</span><span class='tstring_end'>"</span></span> <span class='op'>+</span> <span class='id identifier rubyid_message'>message</span>
|
645
|
+
<span class='kw'>end</span></pre>
|
646
|
+
</td>
|
647
|
+
</tr>
|
648
|
+
</table>
|
649
|
+
</div>
|
650
|
+
|
651
|
+
<div class="method_details ">
|
652
|
+
<h3 class="signature " id="get_screen_width-instance_method">
|
653
|
+
|
654
|
+
- (<tt>Fixnum</tt>) <strong>get_screen_width</strong>
|
655
|
+
|
656
|
+
|
657
|
+
|
658
|
+
|
659
|
+
|
660
|
+
</h3><div class="docstring">
|
661
|
+
<div class="discussion">
|
662
|
+
<p>Gets the current screen width.</p>
|
663
|
+
|
664
|
+
|
665
|
+
</div>
|
666
|
+
</div>
|
667
|
+
<div class="tags">
|
668
|
+
|
669
|
+
<p class="tag_title">Returns:</p>
|
670
|
+
<ul class="return">
|
671
|
+
|
672
|
+
<li>
|
673
|
+
|
674
|
+
|
675
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
676
|
+
|
677
|
+
|
678
|
+
|
679
|
+
—
|
680
|
+
<div class='inline'><p>The screen width.</p>
|
681
|
+
</div>
|
682
|
+
|
683
|
+
</li>
|
684
|
+
|
685
|
+
</ul>
|
686
|
+
|
687
|
+
</div><table class="source_code">
|
688
|
+
<tr>
|
689
|
+
<td>
|
690
|
+
<pre class="lines">
|
691
|
+
|
692
|
+
|
693
|
+
118
|
694
|
+
119
|
695
|
+
120</pre>
|
696
|
+
</td>
|
697
|
+
<td>
|
698
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/console.rb', line 118</span>
|
699
|
+
|
700
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_get_screen_width'>get_screen_width</span>
|
701
|
+
<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'>tput cols</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_integer'>to_integer</span><span class='lparen'>(</span><span class='int'>80</span><span class='rparen'>)</span>
|
702
|
+
<span class='kw'>end</span></pre>
|
703
|
+
</td>
|
704
|
+
</tr>
|
705
|
+
</table>
|
706
|
+
</div>
|
707
|
+
|
708
|
+
<div class="method_details ">
|
709
|
+
<h3 class="signature " id="indent-instance_method">
|
710
|
+
|
711
|
+
- (<tt>String</tt>) <strong>indent</strong>(message, width = true, newline_separator = "\n")
|
712
|
+
|
713
|
+
|
714
|
+
|
715
|
+
|
716
|
+
|
717
|
+
</h3><div class="docstring">
|
718
|
+
<div class="discussion">
|
719
|
+
<p>Indents a message.</p>
|
720
|
+
|
721
|
+
|
722
|
+
</div>
|
723
|
+
</div>
|
724
|
+
<div class="tags">
|
725
|
+
<p class="tag_title">Parameters:</p>
|
726
|
+
<ul class="param">
|
727
|
+
|
728
|
+
<li>
|
729
|
+
|
730
|
+
<span class='name'>message</span>
|
731
|
+
|
732
|
+
|
733
|
+
<span class='type'>(<tt>String</tt>)</span>
|
734
|
+
|
735
|
+
|
736
|
+
|
737
|
+
—
|
738
|
+
<div class='inline'><p>The message to indent.</p>
|
739
|
+
</div>
|
740
|
+
|
741
|
+
</li>
|
742
|
+
|
743
|
+
<li>
|
744
|
+
|
745
|
+
<span class='name'>width</span>
|
746
|
+
|
747
|
+
|
748
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
749
|
+
|
750
|
+
|
751
|
+
<em class="default">(defaults to: <tt>true</tt>)</em>
|
752
|
+
|
753
|
+
|
754
|
+
—
|
755
|
+
<div class='inline'><p>The indentation width. <code>true</code> means to use the current indentation, a negative value of <code>-x</code> will indent of <code>x</code> absolute spaces. <code>nil</code> or <code>false</code> will skip indentation.</p>
|
756
|
+
</div>
|
757
|
+
|
758
|
+
</li>
|
759
|
+
|
760
|
+
<li>
|
761
|
+
|
762
|
+
<span class='name'>newline_separator</span>
|
763
|
+
|
764
|
+
|
765
|
+
<span class='type'>(<tt>String</tt>)</span>
|
766
|
+
|
767
|
+
|
768
|
+
<em class="default">(defaults to: <tt>"\n"</tt>)</em>
|
769
|
+
|
770
|
+
|
771
|
+
—
|
772
|
+
<div class='inline'><p>The character used for newlines.</p>
|
773
|
+
</div>
|
774
|
+
|
775
|
+
</li>
|
776
|
+
|
777
|
+
</ul>
|
778
|
+
|
779
|
+
<p class="tag_title">Returns:</p>
|
780
|
+
<ul class="return">
|
781
|
+
|
782
|
+
<li>
|
783
|
+
|
784
|
+
|
785
|
+
<span class='type'>(<tt>String</tt>)</span>
|
786
|
+
|
787
|
+
|
788
|
+
|
789
|
+
—
|
790
|
+
<div class='inline'><p>The indentend message.</p>
|
791
|
+
</div>
|
792
|
+
|
793
|
+
</li>
|
794
|
+
|
795
|
+
</ul>
|
796
|
+
|
797
|
+
</div><table class="source_code">
|
798
|
+
<tr>
|
799
|
+
<td>
|
800
|
+
<pre class="lines">
|
801
|
+
|
802
|
+
|
803
|
+
176
|
804
|
+
177
|
805
|
+
178
|
806
|
+
179
|
807
|
+
180
|
808
|
+
181
|
809
|
+
182
|
810
|
+
183
|
811
|
+
184
|
812
|
+
185
|
813
|
+
186
|
814
|
+
187</pre>
|
815
|
+
</td>
|
816
|
+
<td>
|
817
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/console.rb', line 176</span>
|
818
|
+
|
819
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_indent'>indent</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span><span class='comma'>,</span> <span class='id identifier rubyid_width'>width</span> <span class='op'>=</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='id identifier rubyid_newline_separator'>newline_separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
820
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_width'>width</span><span class='period'>.</span><span class='id identifier rubyid_to_integer'>to_integer</span> <span class='op'>!=</span> <span class='int'>0</span> <span class='kw'>then</span>
|
821
|
+
<span class='id identifier rubyid_width'>width</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_width'>width</span> <span class='op'>==</span> <span class='kw'>true</span> <span class='op'>?</span> <span class='int'>0</span> <span class='op'>:</span> <span class='id identifier rubyid_width'>width</span><span class='period'>.</span><span class='id identifier rubyid_to_integer'>to_integer</span><span class='rparen'>)</span>
|
822
|
+
<span class='id identifier rubyid_width'>width</span> <span class='op'>=</span> <span class='id identifier rubyid_width'>width</span> <span class='op'><</span> <span class='int'>0</span> <span class='op'>?</span> <span class='op'>-</span><span class='id identifier rubyid_width'>width</span> <span class='op'>:</span> <span class='ivar'>@indentation</span> <span class='op'>+</span> <span class='id identifier rubyid_width'>width</span>
|
823
|
+
|
824
|
+
<span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='id identifier rubyid_message'>message</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='id identifier rubyid_newline_separator'>newline_separator</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_line'>line</span><span class='op'>|</span>
|
825
|
+
<span class='lparen'>(</span><span class='ivar'>@indentation_string</span> <span class='op'>*</span> <span class='id identifier rubyid_width'>width</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='id identifier rubyid_line'>line</span>
|
826
|
+
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_newline_separator'>newline_separator</span><span class='rparen'>)</span>
|
827
|
+
<span class='kw'>end</span>
|
828
|
+
|
829
|
+
<span class='id identifier rubyid_message'>message</span>
|
830
|
+
<span class='kw'>end</span></pre>
|
831
|
+
</td>
|
832
|
+
</tr>
|
833
|
+
</table>
|
834
|
+
</div>
|
835
|
+
|
836
|
+
<div class="method_details ">
|
837
|
+
<h3 class="signature " id="reset_indentation-instance_method">
|
838
|
+
|
839
|
+
- (<tt>Fixnum</tt>) <strong>reset_indentation</strong>
|
840
|
+
|
841
|
+
|
842
|
+
|
843
|
+
|
844
|
+
|
845
|
+
</h3><div class="docstring">
|
846
|
+
<div class="discussion">
|
847
|
+
<p>Resets indentation width to <code>0</code>.</p>
|
848
|
+
|
849
|
+
|
850
|
+
</div>
|
851
|
+
</div>
|
852
|
+
<div class="tags">
|
853
|
+
|
854
|
+
<p class="tag_title">Returns:</p>
|
855
|
+
<ul class="return">
|
856
|
+
|
857
|
+
<li>
|
858
|
+
|
859
|
+
|
860
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
861
|
+
|
862
|
+
|
863
|
+
|
864
|
+
—
|
865
|
+
<div class='inline'><p>The new indentation width.</p>
|
866
|
+
</div>
|
867
|
+
|
868
|
+
</li>
|
869
|
+
|
870
|
+
</ul>
|
871
|
+
|
872
|
+
</div><table class="source_code">
|
873
|
+
<tr>
|
874
|
+
<td>
|
875
|
+
<pre class="lines">
|
876
|
+
|
877
|
+
|
878
|
+
135
|
879
|
+
136
|
880
|
+
137</pre>
|
881
|
+
</td>
|
882
|
+
<td>
|
883
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/console.rb', line 135</span>
|
884
|
+
|
885
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_reset_indentation'>reset_indentation</span>
|
886
|
+
<span class='ivar'>@indentation</span> <span class='op'>=</span> <span class='int'>0</span>
|
887
|
+
<span class='kw'>end</span></pre>
|
888
|
+
</td>
|
889
|
+
</tr>
|
890
|
+
</table>
|
891
|
+
</div>
|
892
|
+
|
893
|
+
<div class="method_details ">
|
894
|
+
<h3 class="signature " id="set_indentation-instance_method">
|
895
|
+
|
896
|
+
- (<tt>Fixnum</tt>) <strong>set_indentation</strong>(width, is_absolute = false)
|
897
|
+
|
898
|
+
|
899
|
+
|
900
|
+
|
901
|
+
|
902
|
+
</h3><div class="docstring">
|
903
|
+
<div class="discussion">
|
904
|
+
<p>Sets the new indentation width.</p>
|
905
|
+
|
906
|
+
|
907
|
+
</div>
|
908
|
+
</div>
|
909
|
+
<div class="tags">
|
910
|
+
<p class="tag_title">Parameters:</p>
|
911
|
+
<ul class="param">
|
912
|
+
|
913
|
+
<li>
|
914
|
+
|
915
|
+
<span class='name'>width</span>
|
916
|
+
|
917
|
+
|
918
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
919
|
+
|
920
|
+
|
921
|
+
|
922
|
+
—
|
923
|
+
<div class='inline'><p>The new width.</p>
|
924
|
+
</div>
|
925
|
+
|
926
|
+
</li>
|
927
|
+
|
928
|
+
<li>
|
929
|
+
|
930
|
+
<span class='name'>is_absolute</span>
|
931
|
+
|
932
|
+
|
933
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
934
|
+
|
935
|
+
|
936
|
+
<em class="default">(defaults to: <tt>false</tt>)</em>
|
937
|
+
|
938
|
+
|
939
|
+
—
|
940
|
+
<div class='inline'><p>If the new width should not be added to the current one but rather replace it.</p>
|
941
|
+
</div>
|
942
|
+
|
943
|
+
</li>
|
944
|
+
|
945
|
+
</ul>
|
946
|
+
|
947
|
+
<p class="tag_title">Returns:</p>
|
948
|
+
<ul class="return">
|
949
|
+
|
950
|
+
<li>
|
951
|
+
|
952
|
+
|
953
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
954
|
+
|
955
|
+
|
956
|
+
|
957
|
+
—
|
958
|
+
<div class='inline'><p>The new indentation width.</p>
|
959
|
+
</div>
|
960
|
+
|
961
|
+
</li>
|
962
|
+
|
963
|
+
</ul>
|
964
|
+
|
965
|
+
</div><table class="source_code">
|
966
|
+
<tr>
|
967
|
+
<td>
|
968
|
+
<pre class="lines">
|
969
|
+
|
970
|
+
|
971
|
+
127
|
972
|
+
128
|
973
|
+
129
|
974
|
+
130</pre>
|
975
|
+
</td>
|
976
|
+
<td>
|
977
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/console.rb', line 127</span>
|
978
|
+
|
979
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_set_indentation'>set_indentation</span><span class='lparen'>(</span><span class='id identifier rubyid_width'>width</span><span class='comma'>,</span> <span class='id identifier rubyid_is_absolute'>is_absolute</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
980
|
+
<span class='ivar'>@indentation</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='lparen'>(</span><span class='op'>!</span><span class='id identifier rubyid_is_absolute'>is_absolute</span> <span class='op'>?</span> <span class='ivar'>@indentation</span> <span class='op'>:</span> <span class='int'>0</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='id identifier rubyid_width'>width</span><span class='comma'>,</span> <span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_max'>max</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
|
981
|
+
<span class='ivar'>@indentation</span>
|
982
|
+
<span class='kw'>end</span></pre>
|
983
|
+
</td>
|
984
|
+
</tr>
|
985
|
+
</table>
|
986
|
+
</div>
|
987
|
+
|
988
|
+
<div class="method_details ">
|
989
|
+
<h3 class="signature " id="with_indentation-instance_method">
|
990
|
+
|
991
|
+
- (<tt>Fixnum</tt>) <strong>with_indentation</strong>(width = 3, is_absolute = false)
|
992
|
+
|
993
|
+
|
994
|
+
|
995
|
+
|
996
|
+
|
997
|
+
</h3><div class="docstring">
|
998
|
+
<div class="discussion">
|
999
|
+
<p>Starts a indented region of text.</p>
|
1000
|
+
|
1001
|
+
|
1002
|
+
</div>
|
1003
|
+
</div>
|
1004
|
+
<div class="tags">
|
1005
|
+
<p class="tag_title">Parameters:</p>
|
1006
|
+
<ul class="param">
|
1007
|
+
|
1008
|
+
<li>
|
1009
|
+
|
1010
|
+
<span class='name'>width</span>
|
1011
|
+
|
1012
|
+
|
1013
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
1014
|
+
|
1015
|
+
|
1016
|
+
<em class="default">(defaults to: <tt>3</tt>)</em>
|
1017
|
+
|
1018
|
+
|
1019
|
+
—
|
1020
|
+
<div class='inline'><p>The new width.</p>
|
1021
|
+
</div>
|
1022
|
+
|
1023
|
+
</li>
|
1024
|
+
|
1025
|
+
<li>
|
1026
|
+
|
1027
|
+
<span class='name'>is_absolute</span>
|
1028
|
+
|
1029
|
+
|
1030
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
1031
|
+
|
1032
|
+
|
1033
|
+
<em class="default">(defaults to: <tt>false</tt>)</em>
|
1034
|
+
|
1035
|
+
|
1036
|
+
—
|
1037
|
+
<div class='inline'><p>If the new width should not be added to the current one but rather replace it.</p>
|
1038
|
+
</div>
|
1039
|
+
|
1040
|
+
</li>
|
1041
|
+
|
1042
|
+
</ul>
|
1043
|
+
|
1044
|
+
<p class="tag_title">Returns:</p>
|
1045
|
+
<ul class="return">
|
1046
|
+
|
1047
|
+
<li>
|
1048
|
+
|
1049
|
+
|
1050
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
1051
|
+
|
1052
|
+
|
1053
|
+
|
1054
|
+
—
|
1055
|
+
<div class='inline'><p>The new indentation width.</p>
|
1056
|
+
</div>
|
1057
|
+
|
1058
|
+
</li>
|
1059
|
+
|
1060
|
+
</ul>
|
1061
|
+
|
1062
|
+
</div><table class="source_code">
|
1063
|
+
<tr>
|
1064
|
+
<td>
|
1065
|
+
<pre class="lines">
|
1066
|
+
|
1067
|
+
|
1068
|
+
144
|
1069
|
+
145
|
1070
|
+
146
|
1071
|
+
147
|
1072
|
+
148
|
1073
|
+
149
|
1074
|
+
150
|
1075
|
+
151</pre>
|
1076
|
+
</td>
|
1077
|
+
<td>
|
1078
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/console.rb', line 144</span>
|
1079
|
+
|
1080
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_with_indentation'>with_indentation</span><span class='lparen'>(</span><span class='id identifier rubyid_width'>width</span> <span class='op'>=</span> <span class='int'>3</span><span class='comma'>,</span> <span class='id identifier rubyid_is_absolute'>is_absolute</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
1081
|
+
<span class='id identifier rubyid_old'>old</span> <span class='op'>=</span> <span class='ivar'>@indentation</span>
|
1082
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_set_indentation'>set_indentation</span><span class='lparen'>(</span><span class='id identifier rubyid_width'>width</span><span class='comma'>,</span> <span class='id identifier rubyid_is_absolute'>is_absolute</span><span class='rparen'>)</span>
|
1083
|
+
<span class='kw'>yield</span>
|
1084
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_set_indentation'>set_indentation</span><span class='lparen'>(</span><span class='id identifier rubyid_old'>old</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
1085
|
+
|
1086
|
+
<span class='ivar'>@indentation</span>
|
1087
|
+
<span class='kw'>end</span></pre>
|
1088
|
+
</td>
|
1089
|
+
</tr>
|
1090
|
+
</table>
|
1091
|
+
</div>
|
1092
|
+
|
1093
|
+
<div class="method_details ">
|
1094
|
+
<h3 class="signature " id="wrap-instance_method">
|
1095
|
+
|
1096
|
+
- (<tt>String</tt>) <strong>wrap</strong>(message, width = nil)
|
1097
|
+
|
1098
|
+
|
1099
|
+
|
1100
|
+
|
1101
|
+
|
1102
|
+
</h3><div class="docstring">
|
1103
|
+
<div class="discussion">
|
1104
|
+
<p>Wraps a message in fixed line width.</p>
|
1105
|
+
|
1106
|
+
|
1107
|
+
</div>
|
1108
|
+
</div>
|
1109
|
+
<div class="tags">
|
1110
|
+
<p class="tag_title">Parameters:</p>
|
1111
|
+
<ul class="param">
|
1112
|
+
|
1113
|
+
<li>
|
1114
|
+
|
1115
|
+
<span class='name'>message</span>
|
1116
|
+
|
1117
|
+
|
1118
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1119
|
+
|
1120
|
+
|
1121
|
+
|
1122
|
+
—
|
1123
|
+
<div class='inline'><p>The message to wrap.</p>
|
1124
|
+
</div>
|
1125
|
+
|
1126
|
+
</li>
|
1127
|
+
|
1128
|
+
<li>
|
1129
|
+
|
1130
|
+
<span class='name'>width</span>
|
1131
|
+
|
1132
|
+
|
1133
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
1134
|
+
|
1135
|
+
|
1136
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1137
|
+
|
1138
|
+
|
1139
|
+
—
|
1140
|
+
<div class='inline'><p>The maximum width of a line. Default to the current line width.</p>
|
1141
|
+
</div>
|
1142
|
+
|
1143
|
+
</li>
|
1144
|
+
|
1145
|
+
</ul>
|
1146
|
+
|
1147
|
+
<p class="tag_title">Returns:</p>
|
1148
|
+
<ul class="return">
|
1149
|
+
|
1150
|
+
<li>
|
1151
|
+
|
1152
|
+
|
1153
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1154
|
+
|
1155
|
+
|
1156
|
+
|
1157
|
+
—
|
1158
|
+
<div class='inline'><p>The wrapped message.</p>
|
1159
|
+
</div>
|
1160
|
+
|
1161
|
+
</li>
|
1162
|
+
|
1163
|
+
</ul>
|
1164
|
+
|
1165
|
+
</div><table class="source_code">
|
1166
|
+
<tr>
|
1167
|
+
<td>
|
1168
|
+
<pre class="lines">
|
1169
|
+
|
1170
|
+
|
1171
|
+
158
|
1172
|
+
159
|
1173
|
+
160
|
1174
|
+
161
|
1175
|
+
162
|
1176
|
+
163
|
1177
|
+
164
|
1178
|
+
165
|
1179
|
+
166
|
1180
|
+
167
|
1181
|
+
168</pre>
|
1182
|
+
</td>
|
1183
|
+
<td>
|
1184
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/console.rb', line 158</span>
|
1185
|
+
|
1186
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_wrap'>wrap</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span><span class='comma'>,</span> <span class='id identifier rubyid_width'>width</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1187
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_width'>width</span><span class='period'>.</span><span class='id identifier rubyid_to_integer'>to_integer</span> <span class='op'><=</span> <span class='int'>0</span> <span class='kw'>then</span>
|
1188
|
+
<span class='id identifier rubyid_message'>message</span>
|
1189
|
+
<span class='kw'>else</span>
|
1190
|
+
<span class='id identifier rubyid_width'>width</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_width'>width</span> <span class='op'>==</span> <span class='kw'>true</span> <span class='op'>||</span> <span class='id identifier rubyid_width'>width</span><span class='period'>.</span><span class='id identifier rubyid_to_integer'>to_integer</span> <span class='op'><</span> <span class='int'>0</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> <span class='op'>:</span> <span class='id identifier rubyid_width'>width</span><span class='period'>.</span><span class='id identifier rubyid_to_integer'>to_integer</span><span class='rparen'>)</span>
|
1191
|
+
|
1192
|
+
<span class='id identifier rubyid_message'>message</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_line'>line</span><span class='op'>|</span>
|
1193
|
+
<span class='id identifier rubyid_line'>line</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>></span> <span class='id identifier rubyid_width'>width</span> <span class='op'>?</span> <span class='id identifier rubyid_line'>line</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>(.{1,</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_width'>width</span><span class='rbrace'>}</span><span class='tstring_content'>})(\s+|$)</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\\1\n</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span> <span class='op'>:</span> <span class='id identifier rubyid_line'>line</span>
|
1194
|
+
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1195
|
+
<span class='kw'>end</span>
|
1196
|
+
<span class='kw'>end</span></pre>
|
1197
|
+
</td>
|
1198
|
+
</tr>
|
1199
|
+
</table>
|
1200
|
+
</div>
|
1201
|
+
|
1202
|
+
</div>
|
1203
|
+
|
1204
|
+
</div>
|
1205
|
+
|
1206
|
+
<div id="footer">
|
1207
|
+
Generated on Fri Feb 1 23:40:18 2013 by
|
1208
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1209
|
+
0.8.3 (ruby-1.9.3).
|
1210
|
+
</div>
|
1211
|
+
|
1212
|
+
</body>
|
1213
|
+
</html>
|