rconfigurator 0.0.2 → 0.0.3
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/README +34 -20
- data/doc/Gemfile.html +98 -0
- data/doc/LICENSE_txt.html +94 -0
- data/doc/RConfigurator.html +223 -0
- data/doc/RConfigurator/Configurator.html +332 -0
- data/doc/RConfigurator/StringUtilities.html +194 -0
- data/doc/README.html +203 -0
- data/doc/Rakefile.html +100 -0
- data/doc/bin/rconfig.html +58 -0
- data/doc/created.rid +11 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +76 -0
- data/doc/js/darkfish.js +116 -0
- data/doc/js/jquery.js +32 -0
- data/doc/js/quicksearch.js +114 -0
- data/doc/js/thickbox-compressed.js +10 -0
- data/doc/lib/rconfigurator/configurator_rb.html +55 -0
- data/doc/lib/rconfigurator/utilities_rb.html +52 -0
- data/doc/lib/rconfigurator/version_rb.html +52 -0
- data/doc/lib/rconfigurator_rb.html +56 -0
- data/doc/rdoc.css +763 -0
- data/doc/spec/rconfigurator/rconfigurator_spec_rb.html +54 -0
- data/lib/rconfigurator.rb +5 -0
- data/lib/rconfigurator/version.rb +1 -1
- data/spec/rconfigurator/rconfigurator_spec.rb +11 -3
- data/spec/resources/sample.yml +4 -0
- metadata +44 -4
@@ -0,0 +1,332 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
7
|
+
|
8
|
+
<title>Class: RConfigurator::Configurator</title>
|
9
|
+
|
10
|
+
<link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
|
11
|
+
|
12
|
+
<script src="../js/jquery.js" type="text/javascript" charset="utf-8"></script>
|
13
|
+
<script src="../js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
|
14
|
+
<script src="../js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
|
15
|
+
<script src="../js/darkfish.js" type="text/javascript" charset="utf-8"></script>
|
16
|
+
|
17
|
+
</head>
|
18
|
+
<body id="top" class="class">
|
19
|
+
|
20
|
+
<div id="metadata">
|
21
|
+
<div id="home-metadata">
|
22
|
+
<div id="home-section" class="section">
|
23
|
+
<h3 class="section-header">
|
24
|
+
<a href="../index.html">Home</a>
|
25
|
+
<a href="../index.html#classes">Classes</a>
|
26
|
+
<a href="../index.html#methods">Methods</a>
|
27
|
+
</h3>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div id="file-metadata">
|
32
|
+
<div id="file-list-section" class="section">
|
33
|
+
<h3 class="section-header">In Files</h3>
|
34
|
+
<div class="section-body">
|
35
|
+
<ul>
|
36
|
+
|
37
|
+
<li><a href="../lib/rconfigurator_rb.html?TB_iframe=true&height=550&width=785"
|
38
|
+
class="thickbox" title="lib/rconfigurator.rb">lib/rconfigurator.rb</a></li>
|
39
|
+
|
40
|
+
</ul>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<div id="class-metadata">
|
48
|
+
|
49
|
+
<!-- Parent Class -->
|
50
|
+
<div id="parent-class-section" class="section">
|
51
|
+
<h3 class="section-header">Parent</h3>
|
52
|
+
|
53
|
+
<p class="link">Object</p>
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
<!-- Method Quickref -->
|
64
|
+
<div id="method-list-section" class="section">
|
65
|
+
<h3 class="section-header">Methods</h3>
|
66
|
+
<ul class="link-list">
|
67
|
+
|
68
|
+
<li><a href="#method-c-new">::new</a></li>
|
69
|
+
|
70
|
+
<li><a href="#method-i-configure">#configure</a></li>
|
71
|
+
|
72
|
+
<li><a href="#method-i-parse_and_recursively_create_constants-21">#parse_and_recursively_create_constants!</a></li>
|
73
|
+
|
74
|
+
</ul>
|
75
|
+
</div>
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<!-- Included Modules -->
|
80
|
+
<div id="includes-section" class="section">
|
81
|
+
<h3 class="section-header">Included Modules</h3>
|
82
|
+
<ul class="link-list">
|
83
|
+
|
84
|
+
|
85
|
+
<li><a class="include" href="StringUtilities.html">RConfigurator::StringUtilities</a></li>
|
86
|
+
|
87
|
+
|
88
|
+
</ul>
|
89
|
+
</div>
|
90
|
+
|
91
|
+
</div>
|
92
|
+
|
93
|
+
<div id="project-metadata">
|
94
|
+
|
95
|
+
|
96
|
+
<div id="fileindex-section" class="section project-section">
|
97
|
+
<h3 class="section-header">Files</h3>
|
98
|
+
<ul>
|
99
|
+
|
100
|
+
<li class="file"><a href="../Gemfile.html">Gemfile</a></li>
|
101
|
+
|
102
|
+
<li class="file"><a href="../LICENSE_txt.html">LICENSE.txt</a></li>
|
103
|
+
|
104
|
+
<li class="file"><a href="../README.html">README</a></li>
|
105
|
+
|
106
|
+
<li class="file"><a href="../Rakefile.html">Rakefile</a></li>
|
107
|
+
|
108
|
+
</ul>
|
109
|
+
</div>
|
110
|
+
|
111
|
+
|
112
|
+
<div id="classindex-section" class="section project-section">
|
113
|
+
<h3 class="section-header">Class/Module Index
|
114
|
+
<span class="search-toggle"><img src="../images/find.png"
|
115
|
+
height="16" width="16" alt="[+]"
|
116
|
+
title="show/hide quicksearch" /></span></h3>
|
117
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
118
|
+
<fieldset>
|
119
|
+
<legend>Quicksearch</legend>
|
120
|
+
<input type="text" name="quicksearch" value=""
|
121
|
+
class="quicksearch-field" />
|
122
|
+
</fieldset>
|
123
|
+
</form>
|
124
|
+
|
125
|
+
<ul class="link-list">
|
126
|
+
|
127
|
+
<li><a href="../RConfigurator.html">RConfigurator</a></li>
|
128
|
+
|
129
|
+
<li><a href="../RConfigurator/Configurator.html">RConfigurator::Configurator</a></li>
|
130
|
+
|
131
|
+
<li><a href="../RConfigurator/StringUtilities.html">RConfigurator::StringUtilities</a></li>
|
132
|
+
|
133
|
+
</ul>
|
134
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
135
|
+
</div>
|
136
|
+
|
137
|
+
|
138
|
+
</div>
|
139
|
+
</div>
|
140
|
+
|
141
|
+
<div id="documentation">
|
142
|
+
<h1 class="class">RConfigurator::Configurator</h1>
|
143
|
+
|
144
|
+
<div id="description" class="description">
|
145
|
+
|
146
|
+
<p>“Hydrate” a Ruby application’s module constants from a configuration
|
147
|
+
.yml</p>
|
148
|
+
|
149
|
+
</div><!-- description -->
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
<div id="5Buntitled-5D" class="documentation-section">
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
<!-- Methods -->
|
164
|
+
|
165
|
+
<div id="public-class-method-details" class="method-section section">
|
166
|
+
<h3 class="section-header">Public Class Methods</h3>
|
167
|
+
|
168
|
+
|
169
|
+
<div id="new-method" class="method-detail ">
|
170
|
+
<a name="method-c-new"></a>
|
171
|
+
|
172
|
+
|
173
|
+
<div class="method-heading">
|
174
|
+
<span class="method-name">new</span><span
|
175
|
+
class="method-args">(project_name, config_file, opts={})</span>
|
176
|
+
<span class="method-click-advice">click to toggle source</span>
|
177
|
+
</div>
|
178
|
+
|
179
|
+
|
180
|
+
<div class="method-description">
|
181
|
+
|
182
|
+
<p><a href="Configurator.html#method-c-new">Configurator.new</a> takes the
|
183
|
+
name of the project and a configuration file It does not perform any
|
184
|
+
configuration yet; you must also call configure if <a
|
185
|
+
href="../RConfigurator.html">RConfigurator</a> is invoked this way.</p>
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
<div class="method-source-code" id="new-source">
|
190
|
+
<pre>
|
191
|
+
<span class="ruby-comment"># File lib/rconfigurator.rb, line 32</span>
|
192
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">project_name</span>, <span class="ruby-identifier">config_file</span>, <span class="ruby-identifier">opts</span>={})
|
193
|
+
<span class="ruby-ivar">@project_name</span> = <span class="ruby-identifier">project_name</span>
|
194
|
+
<span class="ruby-ivar">@config_file</span> = <span class="ruby-identifier">config_file</span>
|
195
|
+
<span class="ruby-ivar">@data</span> = <span class="ruby-constant">YAML</span><span class="ruby-operator">::</span><span class="ruby-identifier">load</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-ivar">@config_file</span>)).<span class="ruby-identifier">to_hash</span>
|
196
|
+
<span class="ruby-keyword">end</span></pre>
|
197
|
+
</div><!-- new-source -->
|
198
|
+
|
199
|
+
</div>
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
</div><!-- new-method -->
|
205
|
+
|
206
|
+
|
207
|
+
</div><!-- public-class-method-details -->
|
208
|
+
|
209
|
+
<div id="public-instance-method-details" class="method-section section">
|
210
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
211
|
+
|
212
|
+
|
213
|
+
<div id="configure-method" class="method-detail ">
|
214
|
+
<a name="method-i-configure"></a>
|
215
|
+
|
216
|
+
|
217
|
+
<div class="method-heading">
|
218
|
+
<span class="method-name">configure</span><span
|
219
|
+
class="method-args">(debug=false)</span>
|
220
|
+
<span class="method-click-advice">click to toggle source</span>
|
221
|
+
</div>
|
222
|
+
|
223
|
+
|
224
|
+
<div class="method-description">
|
225
|
+
|
226
|
+
<p>Kicks off our recursive enumeration of the configuration data and module
|
227
|
+
constant generation business logic.</p>
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
<div class="method-source-code" id="configure-source">
|
232
|
+
<pre>
|
233
|
+
<span class="ruby-comment"># File lib/rconfigurator.rb, line 42</span>
|
234
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">configure</span>(<span class="ruby-identifier">debug</span>=<span class="ruby-keyword">false</span>)
|
235
|
+
<span class="ruby-identifier">parse_and_recursively_create_constants!</span>(<span class="ruby-ivar">@data</span>, [], <span class="ruby-identifier">debug</span>)
|
236
|
+
<span class="ruby-keyword">end</span></pre>
|
237
|
+
</div><!-- configure-source -->
|
238
|
+
|
239
|
+
</div>
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
</div><!-- configure-method -->
|
245
|
+
|
246
|
+
|
247
|
+
<div id="parse_and_recursively_create_constants-21-method" class="method-detail ">
|
248
|
+
<a name="method-i-parse_and_recursively_create_constants-21"></a>
|
249
|
+
|
250
|
+
|
251
|
+
<div class="method-heading">
|
252
|
+
<span class="method-name">parse_and_recursively_create_constants!</span><span
|
253
|
+
class="method-args">(hash, module_context = [], debug=false)</span>
|
254
|
+
<span class="method-click-advice">click to toggle source</span>
|
255
|
+
</div>
|
256
|
+
|
257
|
+
|
258
|
+
<div class="method-description">
|
259
|
+
|
260
|
+
<p>configure application based on an easily-managed .yml file – use
|
261
|
+
‘eval’ to generate constants based on the structure of the hash we get
|
262
|
+
from the yaml. most of the business logic for recursively parsing a hash
|
263
|
+
and creating module constants basically just involves tracking module
|
264
|
+
names properly.</p>
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
<div class="method-source-code" id="parse_and_recursively_create_constants-21-source">
|
269
|
+
<pre>
|
270
|
+
<span class="ruby-comment"># File lib/rconfigurator.rb, line 52</span>
|
271
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">parse_and_recursively_create_constants!</span>(<span class="ruby-identifier">hash</span>, <span class="ruby-identifier">module_context</span> = [], <span class="ruby-identifier">debug</span>=<span class="ruby-keyword">false</span>)
|
272
|
+
<span class="ruby-identifier">hash</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
|
273
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Hash</span>
|
274
|
+
<span class="ruby-identifier">module_name</span> = <span class="ruby-identifier">convert_string_to_camel_case</span>(<span class="ruby-identifier">key</span>)
|
275
|
+
<span class="ruby-identifier">context</span> = <span class="ruby-identifier">module_context</span>.<span class="ruby-identifier">dup</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">module_name</span>
|
276
|
+
<span class="ruby-identifier">parse_and_recursively_create_constants!</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-identifier">key</span>], <span class="ruby-identifier">context</span>, <span class="ruby-identifier">debug</span>)
|
277
|
+
<span class="ruby-keyword">else</span>
|
278
|
+
<span class="ruby-identifier">value_is_a_module</span> = <span class="ruby-keyword">false</span>
|
279
|
+
|
280
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">String</span>
|
281
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">include?</span> <span class="ruby-string">"::"</span>
|
282
|
+
<span class="ruby-identifier">value_is_a_module</span> = <span class="ruby-keyword">true</span>
|
283
|
+
<span class="ruby-keyword">else</span>
|
284
|
+
<span class="ruby-identifier">value</span> = <span class="ruby-node">"\"#{value}\""</span>
|
285
|
+
<span class="ruby-keyword">end</span>
|
286
|
+
<span class="ruby-keyword">end</span>
|
287
|
+
|
288
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">value_is_a_module</span>
|
289
|
+
<span class="ruby-comment"># explicitly build out this module (since it doesn't exist) so that we can talk about it</span>
|
290
|
+
<span class="ruby-identifier">expression</span> = <span class="ruby-identifier">value</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">'::'</span>).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">module_name</span><span class="ruby-operator">|</span> <span class="ruby-node">"module #{module_name}; "</span>}.<span class="ruby-identifier">join</span>(<span class="ruby-string">' '</span>)
|
291
|
+
<span class="ruby-identifier">value</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">'::'</span>).<span class="ruby-identifier">count</span>.<span class="ruby-identifier">times</span> { <span class="ruby-identifier">expression</span> <span class="ruby-operator"><<</span> <span class="ruby-string">"end; "</span>}
|
292
|
+
<span class="ruby-identifier">eval</span>(<span class="ruby-identifier">expression</span>, <span class="ruby-identifier">$_</span><span class="ruby-identifier">_global_scope</span>)
|
293
|
+
<span class="ruby-identifier">puts</span>(<span class="ruby-identifier">expression</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">debug</span>
|
294
|
+
<span class="ruby-keyword">end</span>
|
295
|
+
|
296
|
+
<span class="ruby-comment"># define the given constant</span>
|
297
|
+
<span class="ruby-identifier">depth</span> = <span class="ruby-identifier">module_context</span>.<span class="ruby-identifier">count</span>
|
298
|
+
<span class="ruby-identifier">expr</span> = <span class="ruby-identifier">module_context</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">module_name</span><span class="ruby-operator">|</span> <span class="ruby-node">"module #{module_name}; "</span> }.<span class="ruby-identifier">join</span>(<span class="ruby-string">" "</span>)
|
299
|
+
<span class="ruby-identifier">expr</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"#{key.upcase} = #{value}; "</span>
|
300
|
+
<span class="ruby-identifier">depth</span>.<span class="ruby-identifier">times</span> { <span class="ruby-identifier">expr</span> <span class="ruby-operator"><<</span> <span class="ruby-string">"end; "</span>}
|
301
|
+
<span class="ruby-identifier">expr</span> = <span class="ruby-node">"module #{@project_name}; #{expr}; end"</span>
|
302
|
+
<span class="ruby-identifier">eval</span>(<span class="ruby-identifier">expr</span>, <span class="ruby-identifier">$_</span><span class="ruby-identifier">_global_scope</span>)
|
303
|
+
<span class="ruby-identifier">puts</span>(<span class="ruby-identifier">expr</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">debug</span>
|
304
|
+
<span class="ruby-keyword">end</span>
|
305
|
+
<span class="ruby-keyword">end</span>
|
306
|
+
<span class="ruby-keyword">end</span></pre>
|
307
|
+
</div><!-- parse_and_recursively_create_constants-21-source -->
|
308
|
+
|
309
|
+
</div>
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
</div><!-- parse_and_recursively_create_constants-21-method -->
|
315
|
+
|
316
|
+
|
317
|
+
</div><!-- public-instance-method-details -->
|
318
|
+
|
319
|
+
</div><!-- 5Buntitled-5D -->
|
320
|
+
|
321
|
+
|
322
|
+
</div><!-- documentation -->
|
323
|
+
|
324
|
+
<div id="validator-badges">
|
325
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
326
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
327
|
+
Rdoc Generator</a> 2</small>.</p>
|
328
|
+
</div>
|
329
|
+
|
330
|
+
</body>
|
331
|
+
</html>
|
332
|
+
|
@@ -0,0 +1,194 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
7
|
+
|
8
|
+
<title>Module: RConfigurator::StringUtilities</title>
|
9
|
+
|
10
|
+
<link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
|
11
|
+
|
12
|
+
<script src="../js/jquery.js" type="text/javascript" charset="utf-8"></script>
|
13
|
+
<script src="../js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
|
14
|
+
<script src="../js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
|
15
|
+
<script src="../js/darkfish.js" type="text/javascript" charset="utf-8"></script>
|
16
|
+
|
17
|
+
</head>
|
18
|
+
<body id="top" class="module">
|
19
|
+
|
20
|
+
<div id="metadata">
|
21
|
+
<div id="home-metadata">
|
22
|
+
<div id="home-section" class="section">
|
23
|
+
<h3 class="section-header">
|
24
|
+
<a href="../index.html">Home</a>
|
25
|
+
<a href="../index.html#classes">Classes</a>
|
26
|
+
<a href="../index.html#methods">Methods</a>
|
27
|
+
</h3>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div id="file-metadata">
|
32
|
+
<div id="file-list-section" class="section">
|
33
|
+
<h3 class="section-header">In Files</h3>
|
34
|
+
<div class="section-body">
|
35
|
+
<ul>
|
36
|
+
|
37
|
+
<li><a href="../lib/rconfigurator/utilities_rb.html?TB_iframe=true&height=550&width=785"
|
38
|
+
class="thickbox" title="lib/rconfigurator/utilities.rb">lib/rconfigurator/utilities.rb</a></li>
|
39
|
+
|
40
|
+
</ul>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<div id="class-metadata">
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
<!-- Method Quickref -->
|
56
|
+
<div id="method-list-section" class="section">
|
57
|
+
<h3 class="section-header">Methods</h3>
|
58
|
+
<ul class="link-list">
|
59
|
+
|
60
|
+
<li><a href="#method-i-convert_string_to_camel_case">#convert_string_to_camel_case</a></li>
|
61
|
+
|
62
|
+
</ul>
|
63
|
+
</div>
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
</div>
|
68
|
+
|
69
|
+
<div id="project-metadata">
|
70
|
+
|
71
|
+
|
72
|
+
<div id="fileindex-section" class="section project-section">
|
73
|
+
<h3 class="section-header">Files</h3>
|
74
|
+
<ul>
|
75
|
+
|
76
|
+
<li class="file"><a href="../Gemfile.html">Gemfile</a></li>
|
77
|
+
|
78
|
+
<li class="file"><a href="../LICENSE_txt.html">LICENSE.txt</a></li>
|
79
|
+
|
80
|
+
<li class="file"><a href="../README.html">README</a></li>
|
81
|
+
|
82
|
+
<li class="file"><a href="../Rakefile.html">Rakefile</a></li>
|
83
|
+
|
84
|
+
</ul>
|
85
|
+
</div>
|
86
|
+
|
87
|
+
|
88
|
+
<div id="classindex-section" class="section project-section">
|
89
|
+
<h3 class="section-header">Class/Module Index
|
90
|
+
<span class="search-toggle"><img src="../images/find.png"
|
91
|
+
height="16" width="16" alt="[+]"
|
92
|
+
title="show/hide quicksearch" /></span></h3>
|
93
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
94
|
+
<fieldset>
|
95
|
+
<legend>Quicksearch</legend>
|
96
|
+
<input type="text" name="quicksearch" value=""
|
97
|
+
class="quicksearch-field" />
|
98
|
+
</fieldset>
|
99
|
+
</form>
|
100
|
+
|
101
|
+
<ul class="link-list">
|
102
|
+
|
103
|
+
<li><a href="../RConfigurator.html">RConfigurator</a></li>
|
104
|
+
|
105
|
+
<li><a href="../RConfigurator/Configurator.html">RConfigurator::Configurator</a></li>
|
106
|
+
|
107
|
+
<li><a href="../RConfigurator/StringUtilities.html">RConfigurator::StringUtilities</a></li>
|
108
|
+
|
109
|
+
</ul>
|
110
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
111
|
+
</div>
|
112
|
+
|
113
|
+
|
114
|
+
</div>
|
115
|
+
</div>
|
116
|
+
|
117
|
+
<div id="documentation">
|
118
|
+
<h1 class="module">RConfigurator::StringUtilities</h1>
|
119
|
+
|
120
|
+
<div id="description" class="description">
|
121
|
+
|
122
|
+
<p>takes a string_with_underbars and ConvertsToCamelCase</p>
|
123
|
+
|
124
|
+
</div><!-- description -->
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
<div id="5Buntitled-5D" class="documentation-section">
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
<!-- Methods -->
|
139
|
+
|
140
|
+
<div id="public-instance-method-details" class="method-section section">
|
141
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
142
|
+
|
143
|
+
|
144
|
+
<div id="convert_string_to_camel_case-method" class="method-detail ">
|
145
|
+
<a name="method-i-convert_string_to_camel_case"></a>
|
146
|
+
|
147
|
+
|
148
|
+
<div class="method-heading">
|
149
|
+
<span class="method-name">convert_string_to_camel_case</span><span
|
150
|
+
class="method-args">(string)</span>
|
151
|
+
<span class="method-click-advice">click to toggle source</span>
|
152
|
+
</div>
|
153
|
+
|
154
|
+
|
155
|
+
<div class="method-description">
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
<div class="method-source-code" id="convert_string_to_camel_case-source">
|
162
|
+
<pre>
|
163
|
+
<span class="ruby-comment"># File lib/rconfigurator/utilities.rb, line 7</span>
|
164
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">convert_string_to_camel_case</span>(<span class="ruby-identifier">string</span>)
|
165
|
+
<span class="ruby-identifier">new_string</span> = <span class="ruby-identifier">string</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/^[a-z]|_+[a-z]/</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">upcase</span> }
|
166
|
+
<span class="ruby-identifier">new_string</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-string">'_'</span>, <span class="ruby-string">''</span>)
|
167
|
+
<span class="ruby-identifier">new_string</span>
|
168
|
+
<span class="ruby-keyword">end</span></pre>
|
169
|
+
</div><!-- convert_string_to_camel_case-source -->
|
170
|
+
|
171
|
+
</div>
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
</div><!-- convert_string_to_camel_case-method -->
|
177
|
+
|
178
|
+
|
179
|
+
</div><!-- public-instance-method-details -->
|
180
|
+
|
181
|
+
</div><!-- 5Buntitled-5D -->
|
182
|
+
|
183
|
+
|
184
|
+
</div><!-- documentation -->
|
185
|
+
|
186
|
+
<div id="validator-badges">
|
187
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
188
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
189
|
+
Rdoc Generator</a> 2</small>.</p>
|
190
|
+
</div>
|
191
|
+
|
192
|
+
</body>
|
193
|
+
</html>
|
194
|
+
|