patman 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.rdoc +3 -0
- data/README.rdoc +2 -2
- data/doc/Patman.html +539 -431
- data/doc/Patman/PatmanError.html +44 -43
- data/doc/Patman/PatmanFileError.html +44 -43
- data/doc/Patman/PatmanSearchError.html +44 -43
- data/doc/_index.html +28 -31
- data/doc/class_list.html +24 -31
- data/doc/css/full_list.css +32 -31
- data/doc/css/style.css +250 -93
- data/doc/file.CHANGELOG.html +33 -32
- data/doc/file.README.html +34 -36
- data/doc/file_list.html +29 -31
- data/doc/frames.html +7 -16
- data/doc/index.html +34 -36
- data/doc/js/app.js +147 -74
- data/doc/js/full_list.js +170 -135
- data/doc/method_list.html +241 -155
- data/doc/top-level-namespace.html +34 -36
- data/lib/patman.rb +32 -5
- data/lib/version.rb +1 -1
- data/test/test_patman.rb +24 -10
- metadata +3 -4
data/doc/file.CHANGELOG.html
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
<!DOCTYPE html
|
2
|
-
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
4
3
|
<head>
|
5
|
-
<meta
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
6
|
<title>
|
7
7
|
File: CHANGELOG
|
8
8
|
|
9
|
-
— Documentation by YARD 0.
|
9
|
+
— Documentation by YARD 0.9.16
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -15,9 +15,8 @@
|
|
15
15
|
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
16
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
18
|
-
|
18
|
+
pathId = "CHANGELOG";
|
19
19
|
relpath = '';
|
20
|
-
framesUrl = "frames.html#!file.CHANGELOG.html";
|
21
20
|
</script>
|
22
21
|
|
23
22
|
|
@@ -28,42 +27,43 @@
|
|
28
27
|
|
29
28
|
</head>
|
30
29
|
<body>
|
31
|
-
<div
|
32
|
-
<
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="file_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
33
38
|
|
34
39
|
<a href="_index.html">Index</a> »
|
35
40
|
<span class="title">File: CHANGELOG</span>
|
36
41
|
|
37
|
-
|
38
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
39
42
|
</div>
|
40
43
|
|
41
|
-
|
44
|
+
<div id="search">
|
42
45
|
|
43
46
|
<a class="full_list_link" id="class_list_link"
|
44
47
|
href="class_list.html">
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
</a>
|
52
|
-
|
53
|
-
<a class="full_list_link" id="file_list_link"
|
54
|
-
href="file_list.html">
|
55
|
-
File List
|
48
|
+
|
49
|
+
<svg width="24" height="24">
|
50
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
51
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
52
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
</svg>
|
56
54
|
</a>
|
57
55
|
|
58
56
|
</div>
|
59
|
-
|
60
|
-
|
57
|
+
<div class="clear"></div>
|
58
|
+
</div>
|
61
59
|
|
62
|
-
|
63
|
-
|
64
|
-
<div id="content"><div id='filecontents'>
|
60
|
+
<div id="content"><div id='filecontents'>
|
65
61
|
<h1 id="label-Version+history">Version history</h1>
|
66
|
-
<dl class="rdoc-list label-list"><dt>0.0.
|
62
|
+
<dl class="rdoc-list label-list"><dt>0.0.4
|
63
|
+
<dd>
|
64
|
+
<p>Directory path for file is created at write if needed. Patman.edit method
|
65
|
+
added.</p>
|
66
|
+
</dd><dt>0.0.3
|
67
67
|
<dd>
|
68
68
|
<p>Documentation improvements.</p>
|
69
69
|
</dd><dt>0.0.2
|
@@ -75,11 +75,12 @@
|
|
75
75
|
</dd></dl>
|
76
76
|
</div></div>
|
77
77
|
|
78
|
-
|
79
|
-
Generated on
|
78
|
+
<div id="footer">
|
79
|
+
Generated on Sat Oct 20 17:33:29 2018 by
|
80
80
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
81
|
-
0.
|
81
|
+
0.9.16 (ruby-2.5.1).
|
82
82
|
</div>
|
83
83
|
|
84
|
+
</div>
|
84
85
|
</body>
|
85
86
|
</html>
|
data/doc/file.README.html
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
<!DOCTYPE html
|
2
|
-
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
4
3
|
<head>
|
5
|
-
<meta
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
6
|
<title>
|
7
7
|
File: README
|
8
8
|
|
9
|
-
— Documentation by YARD 0.
|
9
|
+
— Documentation by YARD 0.9.16
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -15,9 +15,8 @@
|
|
15
15
|
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
16
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
18
|
-
|
18
|
+
pathId = "README";
|
19
19
|
relpath = '';
|
20
|
-
framesUrl = "frames.html#!file.README.html";
|
21
20
|
</script>
|
22
21
|
|
23
22
|
|
@@ -28,40 +27,37 @@
|
|
28
27
|
|
29
28
|
</head>
|
30
29
|
<body>
|
31
|
-
<div
|
32
|
-
<
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="file_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
33
38
|
|
34
39
|
<a href="_index.html">Index</a> »
|
35
40
|
<span class="title">File: README</span>
|
36
41
|
|
37
|
-
|
38
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
39
42
|
</div>
|
40
43
|
|
41
|
-
|
44
|
+
<div id="search">
|
42
45
|
|
43
46
|
<a class="full_list_link" id="class_list_link"
|
44
47
|
href="class_list.html">
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
</a>
|
52
|
-
|
53
|
-
<a class="full_list_link" id="file_list_link"
|
54
|
-
href="file_list.html">
|
55
|
-
File List
|
48
|
+
|
49
|
+
<svg width="24" height="24">
|
50
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
51
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
52
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
</svg>
|
56
54
|
</a>
|
57
55
|
|
58
56
|
</div>
|
59
|
-
|
60
|
-
|
57
|
+
<div class="clear"></div>
|
58
|
+
</div>
|
61
59
|
|
62
|
-
|
63
|
-
|
64
|
-
<div id="content"><div id='filecontents'>
|
60
|
+
<div id="content"><div id='filecontents'>
|
65
61
|
<h1 id="label-Patman">Patman</h1>
|
66
62
|
|
67
63
|
<p><span class='object_link'><a href="Patman.html" title="Patman (class)">Patman</a></span> (Patch Manipulator) is a library for text file patching. It can
|
@@ -79,7 +75,7 @@ with Regexp searches or with direct line numbers. The file content is
|
|
79
75
|
edited by adding, removing, or replacing lines. When all edits are done,
|
80
76
|
the updated file content is written to disk.</p>
|
81
77
|
|
82
|
-
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_r'>r</span> <span class='op'>=</span> <span class='const'>Patman</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>edit_me.txt</span><span class='tstring_end'>"</span></span> <span class='rparen'>)</span>
|
78
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_r'>r</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Patman.html" title="Patman (class)">Patman</a></span></span><span class='period'>.</span><span class='id identifier rubyid_read'><span class='object_link'><a href="Patman.html#read-class_method" title="Patman.read (method)">read</a></span></span><span class='lparen'>(</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>edit_me.txt</span><span class='tstring_end'>"</span></span> <span class='rparen'>)</span>
|
83
79
|
<span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_line'>line</span> <span class='int'>10</span>
|
84
80
|
<span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span>
|
85
81
|
<span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span>
|
@@ -102,7 +98,8 @@ every call.</p>
|
|
102
98
|
if curline > 5
|
103
99
|
r.step -2
|
104
100
|
else
|
105
|
-
r.line 10
|
101
|
+
r.line 10
|
102
|
+
</code></pre>
|
106
103
|
|
107
104
|
<p>Current line content is returned by “get” and it can be set with “set”
|
108
105
|
method. Current line content can be replaced with “sub”.</p>
|
@@ -115,7 +112,7 @@ get_range, get_for. They all return the queried item. All other methods
|
|
115
112
|
return <span class='object_link'><a href="Patman.html" title="Patman (class)">Patman</a></span> object itself, hence many <span class='object_link'><a href="Patman.html" title="Patman (class)">Patman</a></span> methods can be
|
116
113
|
“chained”.</p>
|
117
114
|
|
118
|
-
<pre class="code ruby"><code class="ruby"><span class='const'>Patman</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>edit_me.txt</span><span class='tstring_end'>"</span></span> <span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_line'>line</span><span class='lparen'>(</span> <span class='int'>2</span> <span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span>
|
115
|
+
<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="Patman.html" title="Patman (class)">Patman</a></span></span><span class='period'>.</span><span class='id identifier rubyid_read'><span class='object_link'><a href="Patman.html#read-class_method" title="Patman.read (method)">read</a></span></span><span class='lparen'>(</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>edit_me.txt</span><span class='tstring_end'>"</span></span> <span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_line'>line</span><span class='lparen'>(</span> <span class='int'>2</span> <span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span>
|
119
116
|
</code></pre>
|
120
117
|
|
121
118
|
<p>Block commands perform commands over a range of lines. Block commands are:
|
@@ -147,7 +144,7 @@ any editing commands have been applied.</p>
|
|
147
144
|
<h2 id="label-Example+session">Example session</h2>
|
148
145
|
|
149
146
|
<pre class="code ruby"><code class="ruby"><span class='comment'># Open file for reading.
|
150
|
-
</span><span class='id identifier rubyid_r'>r</span> <span class='op'>=</span> <span class='const'>Patman</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>report.txt</span><span class='tstring_end'>"</span></span> <span class='rparen'>)</span>
|
147
|
+
</span><span class='id identifier rubyid_r'>r</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Patman.html" title="Patman (class)">Patman</a></span></span><span class='period'>.</span><span class='id identifier rubyid_read'><span class='object_link'><a href="Patman.html#read-class_method" title="Patman.read (method)">read</a></span></span><span class='lparen'>(</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>report.txt</span><span class='tstring_end'>"</span></span> <span class='rparen'>)</span>
|
151
148
|
|
152
149
|
<span class='comment'># Backup file and find next line with "error", i.e. method chaining.
|
153
150
|
</span><span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_copy'>copy</span><span class='lparen'>(</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>report.txt.org</span><span class='tstring_end'>"</span></span> <span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span><span class='lparen'>(</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>error</span><span class='regexp_end'>/</span></span> <span class='rparen'>)</span>
|
@@ -170,7 +167,7 @@ any editing commands have been applied.</p>
|
|
170
167
|
</span><span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span>
|
171
168
|
</code></pre>
|
172
169
|
|
173
|
-
<h2 id="label-Testing
|
170
|
+
<h2 id="label-Testing">Testing</h2>
|
174
171
|
|
175
172
|
<p>Tests are executed with:</p>
|
176
173
|
|
@@ -178,11 +175,12 @@ any editing commands have been applied.</p>
|
|
178
175
|
</code></pre>
|
179
176
|
</div></div>
|
180
177
|
|
181
|
-
|
182
|
-
Generated on
|
178
|
+
<div id="footer">
|
179
|
+
Generated on Sat Oct 20 17:33:29 2018 by
|
183
180
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
184
|
-
0.
|
181
|
+
0.9.16 (ruby-2.5.1).
|
185
182
|
</div>
|
186
183
|
|
184
|
+
</div>
|
187
185
|
</body>
|
188
186
|
</html>
|
data/doc/file_list.html
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
<!DOCTYPE html
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
1
|
+
<!DOCTYPE html>
|
3
2
|
<html>
|
4
3
|
<head>
|
5
|
-
<meta
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
5
|
+
<meta charset="utf-8" />
|
6
6
|
|
7
7
|
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
|
8
8
|
|
@@ -19,44 +19,42 @@
|
|
19
19
|
<base id="base_target" target="_parent" />
|
20
20
|
</head>
|
21
21
|
<body>
|
22
|
-
<script type="text/javascript" charset="utf-8">
|
23
|
-
var hasFrames = false;
|
24
|
-
try {
|
25
|
-
hasFrames = window.top.frames.main ? true : false;
|
26
|
-
} catch (e) { }
|
27
|
-
if (hasFrames) {
|
28
|
-
document.getElementById('base_target').target = 'main';
|
29
|
-
document.body.className = 'frames';
|
30
|
-
}
|
31
|
-
</script>
|
32
22
|
<div id="content">
|
33
|
-
<
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
23
|
+
<div class="fixed_header">
|
24
|
+
<h1 id="full_list_header">File List</h1>
|
25
|
+
<div id="full_list_nav">
|
26
|
+
|
27
|
+
<span><a target="_self" href="class_list.html">
|
28
|
+
Classes
|
29
|
+
</a></span>
|
30
|
+
|
31
|
+
<span><a target="_self" href="method_list.html">
|
32
|
+
Methods
|
33
|
+
</a></span>
|
34
|
+
|
35
|
+
<span><a target="_self" href="file_list.html">
|
36
|
+
Files
|
37
|
+
</a></span>
|
38
|
+
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="search">Search: <input type="text" /></div>
|
48
42
|
</div>
|
49
|
-
<div id="search">Search: <input type="text" /></div>
|
50
43
|
|
51
44
|
<ul id="full_list" class="file">
|
52
45
|
|
53
46
|
|
54
|
-
<li
|
47
|
+
<li id="object_README" class="odd">
|
48
|
+
<div class="item"><span class="object_link"><a href="index.html" title="README">README</a></span></div>
|
49
|
+
</li>
|
55
50
|
|
56
51
|
|
57
|
-
<li
|
52
|
+
<li id="object_CHANGELOG" class="even">
|
53
|
+
<div class="item"><span class="object_link"><a href="file.CHANGELOG.html" title="CHANGELOG">CHANGELOG</a></span></div>
|
54
|
+
</li>
|
58
55
|
|
59
56
|
|
57
|
+
|
60
58
|
</ul>
|
61
59
|
</div>
|
62
60
|
</body>
|
data/doc/frames.html
CHANGED
@@ -1,26 +1,17 @@
|
|
1
|
-
<!DOCTYPE html
|
2
|
-
|
3
|
-
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
5
3
|
<head>
|
6
|
-
|
7
|
-
<title>Documentation by YARD 0.
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>Documentation by YARD 0.9.16</title>
|
8
6
|
</head>
|
9
7
|
<script type="text/javascript" charset="utf-8">
|
10
|
-
window.onload = function() {
|
11
8
|
var match = unescape(window.location.hash).match(/^#!(.+)/);
|
12
9
|
var name = match ? match[1] : 'index.html';
|
13
10
|
name = name.replace(/^(\w+):\/\//, '').replace(/^\/\//, '');
|
14
|
-
|
15
|
-
'<frame name="list" src="class_list.html" />' +
|
16
|
-
'<frame name="main" src="' + escape(name) + '" />' +
|
17
|
-
'</frameset>');
|
18
|
-
}
|
11
|
+
window.top.location = name;
|
19
12
|
</script>
|
20
13
|
<noscript>
|
21
|
-
<
|
22
|
-
|
23
|
-
<frame name="main" src="index.html" />
|
24
|
-
</frameset>
|
14
|
+
<h1>Oops!</h1>
|
15
|
+
<h2>YARD requires JavaScript!</h2>
|
25
16
|
</noscript>
|
26
17
|
</html>
|
data/doc/index.html
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
<!DOCTYPE html
|
2
|
-
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
4
3
|
<head>
|
5
|
-
<meta
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
6
|
<title>
|
7
7
|
File: README
|
8
8
|
|
9
|
-
— Documentation by YARD 0.
|
9
|
+
— Documentation by YARD 0.9.16
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -15,9 +15,8 @@
|
|
15
15
|
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
16
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
18
|
-
|
18
|
+
pathId = "README";
|
19
19
|
relpath = '';
|
20
|
-
framesUrl = "frames.html#!file.README.html";
|
21
20
|
</script>
|
22
21
|
|
23
22
|
|
@@ -28,40 +27,37 @@
|
|
28
27
|
|
29
28
|
</head>
|
30
29
|
<body>
|
31
|
-
<div
|
32
|
-
<
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
33
38
|
|
34
39
|
<a href="_index.html">Index</a> »
|
35
40
|
<span class="title">File: README</span>
|
36
41
|
|
37
|
-
|
38
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
39
42
|
</div>
|
40
43
|
|
41
|
-
|
44
|
+
<div id="search">
|
42
45
|
|
43
46
|
<a class="full_list_link" id="class_list_link"
|
44
47
|
href="class_list.html">
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
</a>
|
52
|
-
|
53
|
-
<a class="full_list_link" id="file_list_link"
|
54
|
-
href="file_list.html">
|
55
|
-
File List
|
48
|
+
|
49
|
+
<svg width="24" height="24">
|
50
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
51
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
52
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
</svg>
|
56
54
|
</a>
|
57
55
|
|
58
56
|
</div>
|
59
|
-
|
60
|
-
|
57
|
+
<div class="clear"></div>
|
58
|
+
</div>
|
61
59
|
|
62
|
-
|
63
|
-
|
64
|
-
<div id="content"><div id='filecontents'>
|
60
|
+
<div id="content"><div id='filecontents'>
|
65
61
|
<h1 id="label-Patman">Patman</h1>
|
66
62
|
|
67
63
|
<p><span class='object_link'><a href="Patman.html" title="Patman (class)">Patman</a></span> (Patch Manipulator) is a library for text file patching. It can
|
@@ -79,7 +75,7 @@ with Regexp searches or with direct line numbers. The file content is
|
|
79
75
|
edited by adding, removing, or replacing lines. When all edits are done,
|
80
76
|
the updated file content is written to disk.</p>
|
81
77
|
|
82
|
-
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_r'>r</span> <span class='op'>=</span> <span class='const'>Patman</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>edit_me.txt</span><span class='tstring_end'>"</span></span> <span class='rparen'>)</span>
|
78
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_r'>r</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Patman.html" title="Patman (class)">Patman</a></span></span><span class='period'>.</span><span class='id identifier rubyid_read'><span class='object_link'><a href="Patman.html#read-class_method" title="Patman.read (method)">read</a></span></span><span class='lparen'>(</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>edit_me.txt</span><span class='tstring_end'>"</span></span> <span class='rparen'>)</span>
|
83
79
|
<span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_line'>line</span> <span class='int'>10</span>
|
84
80
|
<span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span>
|
85
81
|
<span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span>
|
@@ -102,7 +98,8 @@ every call.</p>
|
|
102
98
|
if curline > 5
|
103
99
|
r.step -2
|
104
100
|
else
|
105
|
-
r.line 10
|
101
|
+
r.line 10
|
102
|
+
</code></pre>
|
106
103
|
|
107
104
|
<p>Current line content is returned by “get” and it can be set with “set”
|
108
105
|
method. Current line content can be replaced with “sub”.</p>
|
@@ -115,7 +112,7 @@ get_range, get_for. They all return the queried item. All other methods
|
|
115
112
|
return <span class='object_link'><a href="Patman.html" title="Patman (class)">Patman</a></span> object itself, hence many <span class='object_link'><a href="Patman.html" title="Patman (class)">Patman</a></span> methods can be
|
116
113
|
“chained”.</p>
|
117
114
|
|
118
|
-
<pre class="code ruby"><code class="ruby"><span class='const'>Patman</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>edit_me.txt</span><span class='tstring_end'>"</span></span> <span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_line'>line</span><span class='lparen'>(</span> <span class='int'>2</span> <span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span>
|
115
|
+
<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="Patman.html" title="Patman (class)">Patman</a></span></span><span class='period'>.</span><span class='id identifier rubyid_read'><span class='object_link'><a href="Patman.html#read-class_method" title="Patman.read (method)">read</a></span></span><span class='lparen'>(</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>edit_me.txt</span><span class='tstring_end'>"</span></span> <span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_line'>line</span><span class='lparen'>(</span> <span class='int'>2</span> <span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span>
|
119
116
|
</code></pre>
|
120
117
|
|
121
118
|
<p>Block commands perform commands over a range of lines. Block commands are:
|
@@ -147,7 +144,7 @@ any editing commands have been applied.</p>
|
|
147
144
|
<h2 id="label-Example+session">Example session</h2>
|
148
145
|
|
149
146
|
<pre class="code ruby"><code class="ruby"><span class='comment'># Open file for reading.
|
150
|
-
</span><span class='id identifier rubyid_r'>r</span> <span class='op'>=</span> <span class='const'>Patman</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>report.txt</span><span class='tstring_end'>"</span></span> <span class='rparen'>)</span>
|
147
|
+
</span><span class='id identifier rubyid_r'>r</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Patman.html" title="Patman (class)">Patman</a></span></span><span class='period'>.</span><span class='id identifier rubyid_read'><span class='object_link'><a href="Patman.html#read-class_method" title="Patman.read (method)">read</a></span></span><span class='lparen'>(</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>report.txt</span><span class='tstring_end'>"</span></span> <span class='rparen'>)</span>
|
151
148
|
|
152
149
|
<span class='comment'># Backup file and find next line with "error", i.e. method chaining.
|
153
150
|
</span><span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_copy'>copy</span><span class='lparen'>(</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>report.txt.org</span><span class='tstring_end'>"</span></span> <span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span><span class='lparen'>(</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>error</span><span class='regexp_end'>/</span></span> <span class='rparen'>)</span>
|
@@ -170,7 +167,7 @@ any editing commands have been applied.</p>
|
|
170
167
|
</span><span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span>
|
171
168
|
</code></pre>
|
172
169
|
|
173
|
-
<h2 id="label-Testing
|
170
|
+
<h2 id="label-Testing">Testing</h2>
|
174
171
|
|
175
172
|
<p>Tests are executed with:</p>
|
176
173
|
|
@@ -178,11 +175,12 @@ any editing commands have been applied.</p>
|
|
178
175
|
</code></pre>
|
179
176
|
</div></div>
|
180
177
|
|
181
|
-
|
182
|
-
Generated on
|
178
|
+
<div id="footer">
|
179
|
+
Generated on Sat Oct 20 17:33:29 2018 by
|
183
180
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
184
|
-
0.
|
181
|
+
0.9.16 (ruby-2.5.1).
|
185
182
|
</div>
|
186
183
|
|
184
|
+
</div>
|
187
185
|
</body>
|
188
186
|
</html>
|