Skip to content
Browse files

add more info to base object extensions

  • Loading branch information...
1 parent 17ba2ec commit 8b0d97c216e1dcc8ee413b395f331920f2e0626d @MSNexploder committed Aug 13, 2011
Showing with 20 additions and 4 deletions.
  1. +11 −2 docs/index.html
  2. +9 −2 src/inflect/index.coffee
View
13 docs/index.html
@@ -23,9 +23,18 @@
<span class="nv">exports.singularize = </span><span class="nx">methods</span><span class="p">.</span><span class="nx">singularize</span>
<span class="nv">exports.humanize = </span><span class="nx">methods</span><span class="p">.</span><span class="nx">humanize</span>
<span class="nv">exports.ordinalize = </span><span class="nx">methods</span><span class="p">.</span><span class="nx">ordinalize</span>
-<span class="nv">exports.parameterize = </span><span class="nx">methods</span><span class="p">.</span><span class="nx">parameterize</span></pre></div> </td> </tr> <tr id="section-4"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-4">&#182;</a> </div> <p>object extensions</p>
+<span class="nv">exports.parameterize = </span><span class="nx">methods</span><span class="p">.</span><span class="nx">parameterize</span></pre></div> </td> </tr> <tr id="section-4"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-4">&#182;</a> </div> <p>Base object extensions</p>
-<p>Only enable them if you know what you are doing</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">string_extensions = </span><span class="nx">require</span><span class="p">(</span><span class="s1">&#39;./string_extensions&#39;</span><span class="p">)</span>
+<p>These methods can be used to extend the built-in String and Number classes
+with additional convenience methods.</p>
+
+<h3>Examples</h3>
+
+<pre><code>1.ordinalize() # =&gt; "1st"
+"post".pluralize() # =&gt; "posts"
+</code></pre>
+
+<p>They extend Base objects - so use with care and only enable them if you knwo what you are doing.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">string_extensions = </span><span class="nx">require</span><span class="p">(</span><span class="s1">&#39;./string_extensions&#39;</span><span class="p">)</span>
<span class="nv">number_extensions = </span><span class="nx">require</span><span class="p">(</span><span class="s1">&#39;./number_extensions&#39;</span><span class="p">)</span>
<span class="nv">exports.enableStringExtensions = </span><span class="nx">string_extensions</span><span class="p">.</span><span class="nx">enableStringExtensions</span>
<span class="nv">exports.enableNumberExtensions = </span><span class="nx">number_extensions</span><span class="p">.</span><span class="nx">enableNumberExtensions</span>
View
11 src/inflect/index.coffee
@@ -30,9 +30,16 @@ exports.humanize = methods.humanize
exports.ordinalize = methods.ordinalize
exports.parameterize = methods.parameterize
-# object extensions
+# Base object extensions
#
-# Only enable them if you know what you are doing
+# These methods can be used to extend the built-in String and Number classes
+# with additional convenience methods.
+#
+# ### Examples
+# 1.ordinalize() # => "1st"
+# "post".pluralize() # => "posts"
+#
+# They extend Base objects - so use with care and only enable them if you knwo what you are doing.
string_extensions = require('./string_extensions')
number_extensions = require('./number_extensions')
exports.enableStringExtensions = string_extensions.enableStringExtensions

0 comments on commit 8b0d97c

Please sign in to comment.
Something went wrong with that request. Please try again.