tool-shed 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +9 -0
- data/LICENSE +20 -0
- data/README.md +52 -0
- data/bin/as-asset-detector +16 -0
- data/bin/as-class-detector +16 -0
- data/bin/as-docp +16 -0
- data/bin/as-manifest +16 -0
- data/bin/as-style-detector +16 -0
- data/coverage/unit/index.html +330 -0
- data/coverage/unit/jquery-1.3.2.min.js +19 -0
- data/coverage/unit/jquery.tablesorter.min.js +15 -0
- data/coverage/unit/lib-hel-asdoc_package_rb.html +447 -0
- data/coverage/unit/lib-hel-manifest_rb.html +555 -0
- data/coverage/unit/lib-hel-opts-asdoc_package_opts_rb.html +195 -0
- data/coverage/unit/lib-hel-opts-manifest_opts_rb.html +195 -0
- data/coverage/unit/lib-hel-opts-tool_opts_rb.html +531 -0
- data/coverage/unit/lib-hel-opts-unused_class_opts_rb.html +207 -0
- data/coverage/unit/lib-hel-opts-unused_style_opts_rb.html +201 -0
- data/coverage/unit/lib-hel-project_tools_rb.html +423 -0
- data/coverage/unit/lib-hel-search_rb.html +363 -0
- data/coverage/unit/lib-hel-stripper_rb.html +357 -0
- data/coverage/unit/lib-hel-tool_rb.html +423 -0
- data/coverage/unit/lib-hel-unused_class_rb.html +675 -0
- data/coverage/unit/lib-hel-unused_style_rb.html +747 -0
- data/coverage/unit/lib-hel-version_rb.html +135 -0
- data/coverage/unit/lib-hel_tools_rb.html +165 -0
- data/coverage/unit/print.css +12 -0
- data/coverage/unit/rcov.js +42 -0
- data/coverage/unit/screen.css +270 -0
- data/coverage.data +0 -0
- data/lib/shed/asdoc_package.rb +64 -0
- data/lib/shed/manifest.rb +82 -0
- data/lib/shed/opts/asdoc_package_opts.rb +22 -0
- data/lib/shed/opts/manifest_opts.rb +22 -0
- data/lib/shed/opts/tool_opts.rb +114 -0
- data/lib/shed/opts/unused_asset_opts.rb +24 -0
- data/lib/shed/opts/unused_class_opts.rb +24 -0
- data/lib/shed/opts/unused_style_opts.rb +23 -0
- data/lib/shed/project_tools.rb +60 -0
- data/lib/shed/search.rb +50 -0
- data/lib/shed/stripper.rb +49 -0
- data/lib/shed/tool.rb +60 -0
- data/lib/shed/unused_asset.rb +68 -0
- data/lib/shed/unused_class.rb +102 -0
- data/lib/shed/unused_style.rb +114 -0
- data/lib/shed/version.rb +12 -0
- data/lib/tool_shed.rb +19 -0
- data/rakefile.rb +109 -0
- data/rdoc/classes/ASDocPackage.html +281 -0
- data/rdoc/classes/ASDocPackageOpts.html +204 -0
- data/rdoc/classes/Manifest.html +323 -0
- data/rdoc/classes/ManifestOpts.html +205 -0
- data/rdoc/classes/ProjectTools.html +302 -0
- data/rdoc/classes/Search.html +203 -0
- data/rdoc/classes/Stripper.html +223 -0
- data/rdoc/classes/Tool.html +313 -0
- data/rdoc/classes/ToolOpts.html +297 -0
- data/rdoc/classes/UnusedClass.html +258 -0
- data/rdoc/classes/UnusedClassOpts.html +206 -0
- data/rdoc/classes/UnusedStyle.html +277 -0
- data/rdoc/classes/UnusedStyleOpts.html +205 -0
- data/rdoc/created.rid +1 -0
- data/rdoc/files/LICENSE.html +129 -0
- data/rdoc/files/README_md.html +138 -0
- data/rdoc/files/lib/hel/asdoc_package_rb.html +107 -0
- data/rdoc/files/lib/hel/manifest_rb.html +107 -0
- data/rdoc/files/lib/hel/opts/asdoc_package_opts_rb.html +107 -0
- data/rdoc/files/lib/hel/opts/manifest_opts_rb.html +107 -0
- data/rdoc/files/lib/hel/opts/tool_opts_rb.html +114 -0
- data/rdoc/files/lib/hel/opts/unused_class_opts_rb.html +107 -0
- data/rdoc/files/lib/hel/opts/unused_style_opts_rb.html +107 -0
- data/rdoc/files/lib/hel/project_tools_rb.html +107 -0
- data/rdoc/files/lib/hel/search_rb.html +114 -0
- data/rdoc/files/lib/hel/stripper_rb.html +107 -0
- data/rdoc/files/lib/hel/tool_rb.html +107 -0
- data/rdoc/files/lib/hel/unused_class_rb.html +107 -0
- data/rdoc/files/lib/hel/unused_style_rb.html +107 -0
- data/rdoc/files/lib/hel/version_rb.html +107 -0
- data/rdoc/files/lib/hel_tools_rb.html +127 -0
- data/rdoc/fr_class_index.html +39 -0
- data/rdoc/fr_file_index.html +43 -0
- data/rdoc/fr_method_index.html +75 -0
- data/rdoc/index.html +24 -0
- data/rdoc/rdoc-style.css +208 -0
- data/test/fixtures/search/App.mxml +0 -0
- data/test/fixtures/search/hide/Hidden.as +0 -0
- data/test/fixtures/search/org/helvector/Main.as +0 -0
- data/test/fixtures/src/org/helvector/Helvector.as +16 -0
- data/test/fixtures/src/org/helvector/one/HelOne.as +14 -0
- data/test/fixtures/src/org/helvector/one/HelOneTwo.mxml +0 -0
- data/test/fixtures/src/org/helvector/one/package.asdoc +1 -0
- data/test/fixtures/src/org/helvector/package.asdoc +1 -0
- data/test/fixtures/src/org/helvector/three/HelThree.as +14 -0
- data/test/fixtures/src/org/helvector/three/package.asdoc +1 -0
- data/test/fixtures/src/org/helvector/two/HelTwo.as +14 -0
- data/test/fixtures/src/org/helvector/two/package.asdoc +1 -0
- data/test/fixtures/unused-asset/assets/css/referenced.css +0 -0
- data/test/fixtures/unused-asset/assets/css/un-referenced.css +0 -0
- data/test/fixtures/unused-asset/assets/fonts/referenced.otf +0 -0
- data/test/fixtures/unused-asset/assets/fonts/un-referenced.otf +0 -0
- data/test/fixtures/unused-asset/assets/img/referenced.jpg +0 -0
- data/test/fixtures/unused-asset/assets/img/referenced.png +0 -0
- data/test/fixtures/unused-asset/assets/img/un-referenced.jpg +0 -0
- data/test/fixtures/unused-asset/assets/img/un-referenced.png +0 -0
- data/test/fixtures/unused-asset/src/org/helvector/ToolShed.as +30 -0
- data/test/fixtures/unused-cla/link-report.xml +17 -0
- data/test/fixtures/unused-cla/manifest.xml +6 -0
- data/test/fixtures/unused-cla/src/Unused.as +0 -0
- data/test/fixtures/unused-cla/src/Used.as +0 -0
- data/test/fixtures/unused-css/css/styles.css +2 -0
- data/test/fixtures/unused-css/css-multiple/more.css +2 -0
- data/test/fixtures/unused-css/css-multiple/styles.css +2 -0
- data/test/fixtures/unused-css/css-with-comments/commented.css +6 -0
- data/test/fixtures/unused-css/src/CSSApp.mxml +5 -0
- data/test/test_helper.rb +9 -0
- data/test/unit/test_asdoc_package.rb +72 -0
- data/test/unit/test_asdoc_package_opts.rb +28 -0
- data/test/unit/test_manifest.rb +53 -0
- data/test/unit/test_manifest_opts.rb +28 -0
- data/test/unit/test_search.rb +67 -0
- data/test/unit/test_source_tools.rb +97 -0
- data/test/unit/test_stripper.rb +56 -0
- data/test/unit/test_tool.rb +73 -0
- data/test/unit/test_tool_opts.rb +81 -0
- data/test/unit/test_unused_asset.rb +59 -0
- data/test/unit/test_unused_asset_opts.rb +32 -0
- data/test/unit/test_unused_class.rb +50 -0
- data/test/unit/test_unused_class_opts.rb +32 -0
- data/test/unit/test_unused_style.rb +103 -0
- data/test/unit/test_unused_style_opts.rb +31 -0
- data/tool-shed-0.0.3.gem +0 -0
- data/tool-shed.gemspec +41 -0
- metadata +265 -0
@@ -0,0 +1,203 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: Search</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">Search</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/lib/hel/search_rb.html">
|
59
|
+
lib/hel/search.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
<div id="description">
|
76
|
+
<p>
|
77
|
+
Collection of methods for searching directories.
|
78
|
+
</p>
|
79
|
+
|
80
|
+
</div>
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div id="method-list">
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
87
|
+
|
88
|
+
<div class="name-list">
|
89
|
+
<a href="#M000045">find_all</a>
|
90
|
+
<a href="#M000046">for_empties</a>
|
91
|
+
</div>
|
92
|
+
</div>
|
93
|
+
|
94
|
+
</div>
|
95
|
+
|
96
|
+
|
97
|
+
<!-- if includes -->
|
98
|
+
|
99
|
+
<div id="section">
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
<!-- if method_list -->
|
109
|
+
<div id="methods">
|
110
|
+
<h3 class="section-bar">Public Class methods</h3>
|
111
|
+
|
112
|
+
<div id="method-M000045" class="method-detail">
|
113
|
+
<a name="M000045"></a>
|
114
|
+
|
115
|
+
<div class="method-heading">
|
116
|
+
<a href="#M000045" class="method-signature">
|
117
|
+
<span class="method-name">find_all</span><span class="method-args">(files_of_type,dir,excluding=[]) {|path| ...}</span>
|
118
|
+
</a>
|
119
|
+
</div>
|
120
|
+
|
121
|
+
<div class="method-description">
|
122
|
+
<p>
|
123
|
+
Searches a directory and it‘s child directories for all the files
|
124
|
+
whose names match the specified regular expression.
|
125
|
+
</p>
|
126
|
+
<p><a class="source-toggle" href="#"
|
127
|
+
onclick="toggleCode('M000045-source');return false;">[Source]</a></p>
|
128
|
+
<div class="method-source-code" id="M000045-source">
|
129
|
+
<pre>
|
130
|
+
<span class="ruby-comment cmt"># File lib/hel/search.rb, line 14</span>
|
131
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">find_all</span>(<span class="ruby-identifier">files_of_type</span>,<span class="ruby-identifier">dir</span>,<span class="ruby-identifier">excluding</span>=[])
|
132
|
+
|
133
|
+
<span class="ruby-constant">Find</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">dir</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">path</span><span class="ruby-operator">|</span>
|
134
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-constant">FileTest</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">path</span>)
|
135
|
+
|
136
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">excluding</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">path</span>))
|
137
|
+
<span class="ruby-constant">Find</span>.<span class="ruby-identifier">prune</span>
|
138
|
+
<span class="ruby-keyword kw">else</span>
|
139
|
+
<span class="ruby-keyword kw">next</span>
|
140
|
+
<span class="ruby-keyword kw">end</span>
|
141
|
+
|
142
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">extname</span>(<span class="ruby-identifier">path</span>) <span class="ruby-operator">=~</span> <span class="ruby-identifier">files_of_type</span>
|
143
|
+
<span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">path</span>
|
144
|
+
<span class="ruby-keyword kw">end</span>
|
145
|
+
<span class="ruby-keyword kw">end</span>
|
146
|
+
<span class="ruby-keyword kw">end</span>
|
147
|
+
</pre>
|
148
|
+
</div>
|
149
|
+
</div>
|
150
|
+
</div>
|
151
|
+
|
152
|
+
<div id="method-M000046" class="method-detail">
|
153
|
+
<a name="M000046"></a>
|
154
|
+
|
155
|
+
<div class="method-heading">
|
156
|
+
<a href="#M000046" class="method-signature">
|
157
|
+
<span class="method-name">for_empties</span><span class="method-args">(path,excluding=[]) {|p if Dir.entries(p).join =~ /^\.\.\.(\.(svn|git))?$/| ...}</span>
|
158
|
+
</a>
|
159
|
+
</div>
|
160
|
+
|
161
|
+
<div class="method-description">
|
162
|
+
<p>
|
163
|
+
Scans the path and its children for empty directories.
|
164
|
+
</p>
|
165
|
+
<p><a class="source-toggle" href="#"
|
166
|
+
onclick="toggleCode('M000046-source');return false;">[Source]</a></p>
|
167
|
+
<div class="method-source-code" id="M000046-source">
|
168
|
+
<pre>
|
169
|
+
<span class="ruby-comment cmt"># File lib/hel/search.rb, line 34</span>
|
170
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">for_empties</span>(<span class="ruby-identifier">path</span>,<span class="ruby-identifier">excluding</span>=[])
|
171
|
+
|
172
|
+
<span class="ruby-constant">Find</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">path</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
|
173
|
+
|
174
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-constant">FileTest</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">p</span>)
|
175
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">excluding</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">p</span>))
|
176
|
+
<span class="ruby-constant">Find</span>.<span class="ruby-identifier">prune</span>
|
177
|
+
<span class="ruby-keyword kw">else</span>
|
178
|
+
<span class="ruby-comment cmt"># Any dir that only contains ., .., and .svn or .git are empty.</span>
|
179
|
+
<span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">p</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">entries</span>(<span class="ruby-identifier">p</span>).<span class="ruby-identifier">join</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^\.\.\.(\.(svn|git))?$/</span>
|
180
|
+
<span class="ruby-keyword kw">end</span>
|
181
|
+
<span class="ruby-keyword kw">end</span>
|
182
|
+
|
183
|
+
<span class="ruby-keyword kw">end</span>
|
184
|
+
|
185
|
+
<span class="ruby-keyword kw">end</span>
|
186
|
+
</pre>
|
187
|
+
</div>
|
188
|
+
</div>
|
189
|
+
</div>
|
190
|
+
|
191
|
+
|
192
|
+
</div>
|
193
|
+
|
194
|
+
|
195
|
+
</div>
|
196
|
+
|
197
|
+
|
198
|
+
<div id="validator-badges">
|
199
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
200
|
+
</div>
|
201
|
+
|
202
|
+
</body>
|
203
|
+
</html>
|
@@ -0,0 +1,223 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: Stripper</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">Stripper</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/lib/hel/stripper_rb.html">
|
59
|
+
lib/hel/stripper.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
<div id="description">
|
76
|
+
<p>
|
77
|
+
encoding: utf-8
|
78
|
+
</p>
|
79
|
+
|
80
|
+
</div>
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div id="method-list">
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
87
|
+
|
88
|
+
<div class="name-list">
|
89
|
+
<a href="#M000049">comments</a>
|
90
|
+
<a href="#M000048">ecma_comments</a>
|
91
|
+
<a href="#M000047">xml_comments</a>
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
|
95
|
+
</div>
|
96
|
+
|
97
|
+
|
98
|
+
<!-- if includes -->
|
99
|
+
|
100
|
+
<div id="section">
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
<!-- if method_list -->
|
110
|
+
<div id="methods">
|
111
|
+
<h3 class="section-bar">Public Class methods</h3>
|
112
|
+
|
113
|
+
<div id="method-M000049" class="method-detail">
|
114
|
+
<a name="M000049"></a>
|
115
|
+
|
116
|
+
<div class="method-heading">
|
117
|
+
<a href="#M000049" class="method-signature">
|
118
|
+
<span class="method-name">comments</span><span class="method-args">(str)</span>
|
119
|
+
</a>
|
120
|
+
</div>
|
121
|
+
|
122
|
+
<div class="method-description">
|
123
|
+
<p>
|
124
|
+
Strips both xml and ecma script <a
|
125
|
+
href="Stripper.html#M000049">comments</a>.
|
126
|
+
</p>
|
127
|
+
<p><a class="source-toggle" href="#"
|
128
|
+
onclick="toggleCode('M000049-source');return false;">[Source]</a></p>
|
129
|
+
<div class="method-source-code" id="M000049-source">
|
130
|
+
<pre>
|
131
|
+
<span class="ruby-comment cmt"># File lib/hel/stripper.rb, line 41</span>
|
132
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">comments</span>(<span class="ruby-identifier">str</span>)
|
133
|
+
<span class="ruby-identifier">str</span> = <span class="ruby-identifier">xml_comments</span>(<span class="ruby-identifier">str</span>)
|
134
|
+
<span class="ruby-identifier">str</span> = <span class="ruby-identifier">ecma_comments</span>(<span class="ruby-identifier">str</span>)
|
135
|
+
<span class="ruby-identifier">str</span>
|
136
|
+
<span class="ruby-keyword kw">end</span>
|
137
|
+
</pre>
|
138
|
+
</div>
|
139
|
+
</div>
|
140
|
+
</div>
|
141
|
+
|
142
|
+
<div id="method-M000048" class="method-detail">
|
143
|
+
<a name="M000048"></a>
|
144
|
+
|
145
|
+
<div class="method-heading">
|
146
|
+
<a href="#M000048" class="method-signature">
|
147
|
+
<span class="method-name">ecma_comments</span><span class="method-args">(str)</span>
|
148
|
+
</a>
|
149
|
+
</div>
|
150
|
+
|
151
|
+
<div class="method-description">
|
152
|
+
<p>
|
153
|
+
Strips <a href="Stripper.html#M000049">comments</a> from the document.
|
154
|
+
</p>
|
155
|
+
<p><a class="source-toggle" href="#"
|
156
|
+
onclick="toggleCode('M000048-source');return false;">[Source]</a></p>
|
157
|
+
<div class="method-source-code" id="M000048-source">
|
158
|
+
<pre>
|
159
|
+
<span class="ruby-comment cmt"># File lib/hel/stripper.rb, line 19</span>
|
160
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ecma_comments</span>(<span class="ruby-identifier">str</span>)
|
161
|
+
|
162
|
+
<span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/\/\*(?:.|([\r\n]))*?\*\//</span>,<span class="ruby-value str">''</span>)
|
163
|
+
|
164
|
+
<span class="ruby-comment cmt"># This is designed to leave whitespace in</span>
|
165
|
+
<span class="ruby-comment cmt"># place so the caret position remains correct.</span>
|
166
|
+
<span class="ruby-comment cmt">#do |s|</span>
|
167
|
+
<span class="ruby-comment cmt"># if $1</span>
|
168
|
+
<span class="ruby-comment cmt"># a = s.split("\n")</span>
|
169
|
+
<span class="ruby-comment cmt"># r = "\n" * (a.length-1) if a.length > 1</span>
|
170
|
+
<span class="ruby-comment cmt"># r</span>
|
171
|
+
<span class="ruby-comment cmt"># end</span>
|
172
|
+
<span class="ruby-comment cmt">#end</span>
|
173
|
+
|
174
|
+
<span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/\/\/.*$/</span>,<span class="ruby-value str">''</span>)
|
175
|
+
<span class="ruby-identifier">str</span>
|
176
|
+
|
177
|
+
<span class="ruby-keyword kw">end</span>
|
178
|
+
</pre>
|
179
|
+
</div>
|
180
|
+
</div>
|
181
|
+
</div>
|
182
|
+
|
183
|
+
<div id="method-M000047" class="method-detail">
|
184
|
+
<a name="M000047"></a>
|
185
|
+
|
186
|
+
<div class="method-heading">
|
187
|
+
<a href="#M000047" class="method-signature">
|
188
|
+
<span class="method-name">xml_comments</span><span class="method-args">(str)</span>
|
189
|
+
</a>
|
190
|
+
</div>
|
191
|
+
|
192
|
+
<div class="method-description">
|
193
|
+
<p>
|
194
|
+
Strips xml <a href="Stripper.html#M000049">comments</a> from the document.
|
195
|
+
</p>
|
196
|
+
<p><a class="source-toggle" href="#"
|
197
|
+
onclick="toggleCode('M000047-source');return false;">[Source]</a></p>
|
198
|
+
<div class="method-source-code" id="M000047-source">
|
199
|
+
<pre>
|
200
|
+
<span class="ruby-comment cmt"># File lib/hel/stripper.rb, line 10</span>
|
201
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">xml_comments</span>(<span class="ruby-identifier">str</span>)
|
202
|
+
<span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/<!--(?:.|([\r\n]))*?-->/</span>,<span class="ruby-value str">''</span>)
|
203
|
+
<span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/<!--.*-->/</span>,<span class="ruby-value str">''</span>)
|
204
|
+
<span class="ruby-identifier">str</span>
|
205
|
+
<span class="ruby-keyword kw">end</span>
|
206
|
+
</pre>
|
207
|
+
</div>
|
208
|
+
</div>
|
209
|
+
</div>
|
210
|
+
|
211
|
+
|
212
|
+
</div>
|
213
|
+
|
214
|
+
|
215
|
+
</div>
|
216
|
+
|
217
|
+
|
218
|
+
<div id="validator-badges">
|
219
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
220
|
+
</div>
|
221
|
+
|
222
|
+
</body>
|
223
|
+
</html>
|