to-class 1.1

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,10 @@
1
+ The MIT License
2
+ ===============
3
+
4
+ © 2011 Cody Robbins
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7
+
8
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9
+
10
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.markdown ADDED
@@ -0,0 +1,27 @@
1
+ To Class
2
+ ========
3
+
4
+ This gem adds a `to_class` method to `ActiveSupport::Inflector` and to `Symbol` that combines the functionality of ActiveSupport’s [`camelize`](http://rubydoc.info/gems/activesupport/ActiveSupport/Inflector:camelize) and [`constantize`](http://rubydoc.info/gems/activesupport/ActiveSupport/Inflector:constantize) methods—it will convert the object in question to Camel case and then try to find a declared constant with the corresponding name. This allows you to easily get a class from its name with one simple method invokation.
5
+
6
+ Full documentation is at [RubyDoc.info](http://rubydoc.info/gems/to-class).
7
+
8
+ Examples
9
+ --------
10
+
11
+ :user.to_class #=> User
12
+ 'user'.to_class #=> User
13
+ :blog_post.to_class #=> BlogPost
14
+ 'blog_post'.to_class #=> BlogPost
15
+
16
+ Tested with
17
+ -----------
18
+
19
+ * ActiveSupport 3.0.5 — 20 May 2011.
20
+
21
+ Credits
22
+ -------
23
+
24
+ © 2011 [Cody Robbins](http://codyrobbins.com/)
25
+
26
+ * [Homepage](http://codyrobbins.com/software/to-class)
27
+ * [Follow me on Twitter](http://twitter.com/codyrobbins)
@@ -0,0 +1,106 @@
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: CodyRobbins
8
+
9
+ &mdash; Documentation by YARD 0.7.1
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
+ relpath = '';
19
+ if (relpath != '') relpath += '/';
20
+ </script>
21
+
22
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
25
+
26
+
27
+ </head>
28
+ <body>
29
+ <script type="text/javascript" charset="utf-8">
30
+ if (window.top.frames.main) document.body.className = 'frames';
31
+ </script>
32
+
33
+ <div id="header">
34
+ <div id="menu">
35
+
36
+ <a href="_index.html">Index (C)</a> &raquo;
37
+
38
+
39
+ <span class="title">CodyRobbins</span>
40
+
41
+
42
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
43
+ </div>
44
+
45
+ <div id="search">
46
+
47
+ <a id="class_list_link" href="#">Class List</a>
48
+
49
+ <a id="method_list_link" href="#">Method List</a>
50
+
51
+ <a id="file_list_link" href="#">File List</a>
52
+
53
+ </div>
54
+ <div class="clear"></div>
55
+ </div>
56
+
57
+ <iframe id="search_frame"></iframe>
58
+
59
+ <div id="content"><h1>Module: CodyRobbins
60
+
61
+
62
+
63
+ </h1>
64
+
65
+ <dl class="box">
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+ <dt class="r1 last">Defined in:</dt>
75
+ <dd class="r1 last">lib/cody_robbins/classifyize.rb</dd>
76
+
77
+ </dl>
78
+ <div class="clear"></div>
79
+
80
+ <h2>Defined Under Namespace</h2>
81
+ <p class="children">
82
+
83
+
84
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="CodyRobbins/ToClass.html" title="CodyRobbins::ToClass (module)">ToClass</a></span>
85
+
86
+
87
+
88
+
89
+ </p>
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+ </div>
98
+
99
+ <div id="footer">
100
+ Generated on Sat May 21 22:35:26 2011 by
101
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
102
+ 0.7.1 (ruby-1.9.2).
103
+ </div>
104
+
105
+ </body>
106
+ </html>
@@ -0,0 +1,201 @@
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: CodyRobbins::ToClass
8
+
9
+ &mdash; Documentation by YARD 0.7.1
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
+ relpath = '..';
19
+ if (relpath != '') relpath += '/';
20
+ </script>
21
+
22
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
25
+
26
+
27
+ </head>
28
+ <body>
29
+ <script type="text/javascript" charset="utf-8">
30
+ if (window.top.frames.main) document.body.className = 'frames';
31
+ </script>
32
+
33
+ <div id="header">
34
+ <div id="menu">
35
+
36
+ <a href="../_index.html">Index (T)</a> &raquo;
37
+ <span class='title'><span class='object_link'><a href="../CodyRobbins.html" title="CodyRobbins (module)">CodyRobbins</a></span></span>
38
+ &raquo;
39
+ <span class="title">ToClass</span>
40
+
41
+
42
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
43
+ </div>
44
+
45
+ <div id="search">
46
+
47
+ <a id="class_list_link" href="#">Class List</a>
48
+
49
+ <a id="method_list_link" href="#">Method List</a>
50
+
51
+ <a id="file_list_link" href="#">File List</a>
52
+
53
+ </div>
54
+ <div class="clear"></div>
55
+ </div>
56
+
57
+ <iframe id="search_frame"></iframe>
58
+
59
+ <div id="content"><h1>Module: CodyRobbins::ToClass
60
+
61
+
62
+
63
+ </h1>
64
+
65
+ <dl class="box">
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+ <dt class="r1 last">Defined in:</dt>
75
+ <dd class="r1 last">lib/cody_robbins/classifyize.rb</dd>
76
+
77
+ </dl>
78
+ <div class="clear"></div>
79
+
80
+
81
+
82
+
83
+
84
+
85
+
86
+ <h2>
87
+ Instance Method Summary
88
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
89
+ </h2>
90
+
91
+ <ul class="summary">
92
+
93
+ <li class="public ">
94
+ <span class="summary_signature">
95
+
96
+ <a href="#to_class-instance_method" title="#to_class (instance method)">- (Class) <strong>to_class</strong> </a>
97
+
98
+
99
+
100
+ </span>
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+ <span class="summary_desc"><div class='inline'><p>Converts the object in question to Camel case and then tries to find a declared constant with the corresponding name.</p>
110
+ </div></span>
111
+
112
+ </li>
113
+
114
+
115
+ </ul>
116
+
117
+
118
+
119
+
120
+ <div id="instance_method_details" class="method_details_list">
121
+ <h2>Instance Method Details</h2>
122
+
123
+
124
+ <div class="method_details first">
125
+ <p class="signature first" id="to_class-instance_method">
126
+
127
+ - (<tt>Class</tt>) <strong>to_class</strong>
128
+
129
+
130
+
131
+ </p><div class="docstring">
132
+ <div class="discussion">
133
+ <p>Converts the object in question to Camel case and then tries to find a declared constant with the corresponding name. This combines the functionality of ActiveSupport???s <a href="http://rubydoc.info/gems/activesupport/ActiveSupport/Inflector:camelize"><code>camelize</code></a> and <a href="http://rubydoc.info/gems/activesupport/ActiveSupport/Inflector:constantize"><code>constantize</code></a> methods, and allows you to easily get a class from its name with one simple method invokation.</p>
134
+
135
+
136
+ </div>
137
+ </div>
138
+ <div class="tags">
139
+
140
+ <div class="examples">
141
+ <h3>Examples:</h3>
142
+
143
+ <h4><div class='inline'>
144
+ </div></h4>
145
+ <pre class="example code"><span class='symbol'>:user</span><span class='period'>.</span><span class='id to_class'>to_class</span> <span class='comment'>#=&gt; User
146
+ </span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>user</span><span class='tstring_end'>'</span></span><span class='period'>.</span><span class='id to_class'>to_class</span> <span class='comment'>#=&gt; User
147
+ </span><span class='symbol'>:blog_post</span><span class='period'>.</span><span class='id to_class'>to_class</span> <span class='comment'>#=&gt; BlogPost
148
+ </span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>blog_post</span><span class='tstring_end'>'</span></span><span class='period'>.</span><span class='id to_class'>to_class</span> <span class='comment'>#=&gt; BlogPost</span></pre>
149
+
150
+ </div>
151
+ <h3>Returns:</h3>
152
+ <ul class="return">
153
+
154
+ <li>
155
+
156
+
157
+ <span class='type'>(<tt>Class</tt>)</span>
158
+
159
+
160
+
161
+ &mdash;
162
+ <div class='inline'><p>The class corresponding to the representation of its name.</p>
163
+ </div>
164
+
165
+ </li>
166
+
167
+ </ul>
168
+
169
+ </div><table class="source_code">
170
+ <tr>
171
+ <td>
172
+ <pre class="lines">
173
+
174
+
175
+ 12
176
+ 13
177
+ 14</pre>
178
+ </td>
179
+ <td>
180
+ <pre class="code"><span class="info file"># File 'lib/cody_robbins/classifyize.rb', line 12</span>
181
+
182
+ <span class='kw'>def</span> <span class='id to_class'>to_class</span>
183
+ <span class='id to_s'>to_s</span><span class='period'>.</span><span class='id camelize'>camelize</span><span class='period'>.</span><span class='id constantize'>constantize</span>
184
+ <span class='kw'>end</span></pre>
185
+ </td>
186
+ </tr>
187
+ </table>
188
+ </div>
189
+
190
+ </div>
191
+
192
+ </div>
193
+
194
+ <div id="footer">
195
+ Generated on Sat May 21 22:35:26 2011 by
196
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
197
+ 0.7.1 (ruby-1.9.2).
198
+ </div>
199
+
200
+ </body>
201
+ </html>
data/doc/_index.html ADDED
@@ -0,0 +1,124 @@
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
+ Documentation by YARD 0.7.1
8
+
9
+ </title>
10
+
11
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
12
+
13
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <script type="text/javascript" charset="utf-8">
16
+ relpath = '';
17
+ if (relpath != '') relpath += '/';
18
+ </script>
19
+
20
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
21
+
22
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
23
+
24
+
25
+ </head>
26
+ <body>
27
+ <script type="text/javascript" charset="utf-8">
28
+ if (window.top.frames.main) document.body.className = 'frames';
29
+ </script>
30
+
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+
35
+ <span class="title"></span>
36
+
37
+
38
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
39
+ </div>
40
+
41
+ <div id="search">
42
+
43
+ <a id="class_list_link" href="#">Class List</a>
44
+
45
+ <a id="method_list_link" href="#">Method List</a>
46
+
47
+ <a id="file_list_link" href="#">File List</a>
48
+
49
+ </div>
50
+ <div class="clear"></div>
51
+ </div>
52
+
53
+ <iframe id="search_frame"></iframe>
54
+
55
+ <div id="content"><h1 class="noborder title">Documentation by YARD 0.7.1</h1>
56
+ <div id="listing">
57
+ <h1 class="alphaindex">Alphabetic Index</h1>
58
+
59
+ <h2>File Listing</h2>
60
+ <ul id="files">
61
+
62
+
63
+ <li class="r1"><a href="index.html" title="README">README</a></li>
64
+
65
+
66
+ <li class="r2"><a href="file.LICENSE.html" title="LICENSE">LICENSE</a></li>
67
+
68
+
69
+ </ul>
70
+
71
+ <div class="clear"></div>
72
+ <h2>Namespace Listing A-Z</h2>
73
+
74
+
75
+
76
+
77
+ <table>
78
+ <tr>
79
+ <td valign='top' width="33%">
80
+
81
+
82
+ <ul id="alpha_C" class="alpha">
83
+ <li class="letter">C</li>
84
+ <ul>
85
+
86
+ <li>
87
+ <span class='object_link'><a href="CodyRobbins.html" title="CodyRobbins (module)">CodyRobbins</a></span>
88
+
89
+ </li>
90
+
91
+ </ul>
92
+ </ul>
93
+
94
+
95
+ <ul id="alpha_T" class="alpha">
96
+ <li class="letter">T</li>
97
+ <ul>
98
+
99
+ <li>
100
+ <span class='object_link'><a href="CodyRobbins/ToClass.html" title="CodyRobbins::ToClass (module)">ToClass</a></span>
101
+
102
+ <small>(CodyRobbins)</small>
103
+
104
+ </li>
105
+
106
+ </ul>
107
+ </ul>
108
+
109
+ </td>
110
+ </tr>
111
+ </table>
112
+
113
+ </div>
114
+
115
+ </div>
116
+
117
+ <div id="footer">
118
+ Generated on Sat May 21 22:35:26 2011 by
119
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
120
+ 0.7.1 (ruby-1.9.2).
121
+ </div>
122
+
123
+ </body>
124
+ </html>