time-lord-chinese 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c894f049bf51b33bea1a0c3b2ab17c99acee9c89
4
+ data.tar.gz: 3b263fed11dc4e1a9ad386572ccec2590399c66b
5
+ SHA512:
6
+ metadata.gz: 02c8509f31ff7221aaa07e51d16ade9b63d4ee2179f131fb118aa0257b1483876901c7dcad30ecacf5f9d5a0bbfc39e3acd5d7da1e527af8d0df102ff00fdd49
7
+ data.tar.gz: 797d794d0579fd3e76d020c6c4f5441cd91e6e88a9de903c59ac754c8bb967cc69cc1d0d3189386ed7ec647341c6e1a47130da13d724a6d00667554db2043cf6
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/.rvmrc ADDED
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
+ # development environment upon cd'ing into the directory
5
+
6
+ # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
7
+ environment_id="ruby-1.9.3-p0@time-lord-chinese"
8
+
9
+ #
10
+ # First we attempt to load the desired environment directly from the environment
11
+ # file. This is very fast and efficicent compared to running through the entire
12
+ # CLI and selector. If you want feedback on which environment was used then
13
+ # insert the word 'use' after --create as this triggers verbose mode.
14
+ #
15
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
16
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]] ; then
17
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
18
+
19
+ [[ -s ".rvm/hooks/after_use" ]] && . ".rvm/hooks/after_use"
20
+ else
21
+ # If the environment file has not yet been created, use the RVM CLI to select.
22
+ rvm --create "$environment_id"
23
+ fi
24
+
25
+ #
26
+ # If you use an RVM gemset file to install a list of gems (*.gems), you can have
27
+ # it be automatically loaded. Uncomment the following and adjust the filename if
28
+ # necessary.
29
+ #
30
+ # filename=".gems"
31
+ # if [[ -s "$filename" ]] ; then
32
+ # rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
33
+ # fi
34
+
35
+ #
36
+ # If you use bundler and would like to run bundle each time you enter the
37
+ # directory, you can uncomment the following code.
38
+ #
39
+ # # Ensure that Bundler is installed. Install it if it is not.
40
+ # if ! command -v bundle >/dev/null; then
41
+ # printf "The rubygem 'bundler' is not installed. Installing it now.\n"
42
+ # gem install bundler
43
+ # fi
44
+ #
45
+ # # Bundle while reducing excess noise.
46
+ # printf "Bundling your gems. This may take a few minutes on a fresh clone.\n"
47
+ # bundle | grep -v '^Using ' | grep -v ' is complete' | sed '/^$/d'
48
+ #
49
+
@@ -0,0 +1,2 @@
1
+ lib/time-lord.rb 93a21229aaa27912f8fbaf8113232f9299a94c04
2
+ lib/time-lord/version.rb 1d4a7d9f645c106306ef4700a69712b6ede43db0
Binary file
@@ -0,0 +1,2 @@
1
+ {I" Object:EF:
2
+ class
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2010 Kurtis Rainbolt-Greene:
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in timelord.gemspec
4
+ gemspec
@@ -0,0 +1,130 @@
1
+ time-lord
2
+ =========
3
+
4
+ **Current Version**: 0.0.2
5
+
6
+ `time-lord` is a gem that builds on the Time class to give more human expressions.
7
+ It adds a lot of nifty little ideas present in Rails helpers to the time class.
8
+ Nothing too fancy, just a little human touch to data.
9
+
10
+
11
+ Examples
12
+ --------
13
+
14
+ To use `time-lord` you need a Time, Date, or DateTime object.
15
+ You can pass an object that doesn't act like those, but you'll have to tell it to try and parse.
16
+ Even then it might not be able to, so be careful and just send Time-likes.
17
+ Here's an example or two:
18
+
19
+ ``` ruby
20
+ Time.now.ago_in_words
21
+ # => "just now"
22
+
23
+ olden_times = Time.parse("1942-04-01")
24
+
25
+ "I was dancing with Queen Elizabeth #{olden_times.ago_in_words} from now!"
26
+
27
+ # => "I was dancing with Queen Elizabeth 7 decades ago from now!"
28
+ ```
29
+
30
+ There's a lot more to come hopefully.
31
+ Time is fun.
32
+
33
+
34
+ Installing
35
+ ----------
36
+
37
+ **Requirements**
38
+
39
+ 1. Any Ruby with a Time class
40
+ 2. Any Gem manager
41
+ 3. A blue telephone box
42
+
43
+ Like any other gem you can install it via the `gem` command:
44
+
45
+ ``` terminal
46
+ $ gem install time-lord
47
+ ```
48
+
49
+ Although I suggest using `bundler`:
50
+
51
+ ``` ruby
52
+ gem 'time-lord', '0.0.2'
53
+ ```
54
+
55
+
56
+ **Testing**
57
+
58
+ To make sure you did everything right, just do the following:
59
+
60
+ ```
61
+ $ ruby -e "puts Time.now.ago_in_words"
62
+ > just now
63
+ ```
64
+
65
+
66
+ Issues & Documentation
67
+ ----------------------
68
+
69
+ * [Documentation](https://github.com/krainboltgreene/time-lord/wiki)
70
+ * [Issues](https://github.com/krainboltgreene/time-lord/issues)
71
+
72
+ Absolutely feel free to contribute, please!
73
+
74
+
75
+ Changelog
76
+ ---------
77
+
78
+ **v0.0.2**
79
+
80
+ * time-lord-chinese
81
+
82
+ Contributing
83
+ ------------
84
+
85
+ * **Fork** the repository
86
+ * **Clone the repository** locally, or **edit via Github**
87
+ * Create a **new branch** using the [Git Flow Standard](http://yakiloo.com/getting-started-git-flow/) conventions
88
+ * Commit **often** and **when important**
89
+ * **DO NOT CHANGE** ANY OF THESE (without making a new branch for *that* change):
90
+ * `*.gemspec`
91
+ * `Rakefile`
92
+ * `.rvmrc`
93
+ * `.gitignore`
94
+ * Any part of the git history
95
+ * **Write tests** specifically for the changes you've made, if no test exist
96
+ * **Push** your feature or hotfix branch to Github.
97
+ * Make a **Pull Request**
98
+
99
+
100
+ Credits
101
+ -------
102
+
103
+ * [Simon Hørup Eskildsen](https://github.com/Sirupsen)
104
+ * [Henrik Enggaard](mailto: https://github.com/henrikh)
105
+ * [James Larkby-Lahet](https://github.com/wolfwood)
106
+
107
+
108
+ License
109
+ -------
110
+
111
+ Copyright (c) 2011 Kurtis Rainbolt-Greene
112
+
113
+ Permission is hereby granted, free of charge, to any person obtaining
114
+ a copy of this software and associated documentation files (the
115
+ "Software"), to deal in the Software without restriction, including
116
+ without limitation the rights to use, copy, modify, merge, publish,
117
+ distribute, sublicense, and/or sell copies of the Software, and to
118
+ permit persons to whom the Software is furnished to do so, subject to
119
+ the following conditions:
120
+
121
+ The above copyright notice and this permission notice shall be
122
+ included in all copies or substantial portions of the Software.
123
+
124
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
125
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
126
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
127
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
128
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
129
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
130
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,290 @@
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>Class: Time</title>
7
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
8
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
9
+
10
+ <script type="text/javascript" charset="utf-8">
11
+ relpath = '';
12
+ if (relpath != '') relpath += '/';
13
+ </script>
14
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
15
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
16
+
17
+ </head>
18
+ <body>
19
+ <script type="text/javascript" charset="utf-8">
20
+ if (window.top.frames.main) document.body.className = 'frames';
21
+ </script>
22
+
23
+ <div id="header">
24
+ <div id="menu">
25
+
26
+ <a href="_index.html">Index (T)</a> &raquo;
27
+
28
+
29
+ <span class="title">Time</span>
30
+
31
+
32
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
33
+ </div>
34
+
35
+ <div id="search">
36
+ <a id="class_list_link" href="#">Class List</a>
37
+ <a id="method_list_link" href="#">Method List</a>
38
+ <a id ="file_list_link" href="#">File List</a>
39
+ </div>
40
+
41
+ <div class="clear"></div>
42
+ </div>
43
+
44
+ <iframe id="search_frame"></iframe>
45
+
46
+ <div id="content"><h1>Class: Time
47
+
48
+
49
+
50
+ </h1>
51
+
52
+ <dl class="box">
53
+
54
+ <dt class="r1">Inherits:</dt>
55
+ <dd class="r1">
56
+ <span class="inheritName">Object</span>
57
+
58
+ <ul class="fullTree">
59
+ <li>Object</li>
60
+
61
+ <li class="next">Time</li>
62
+
63
+ </ul>
64
+ <a href="#" class="inheritanceTree">show all</a>
65
+
66
+ </dd>
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+ <dt class="r2 last">Defined in:</dt>
77
+ <dd class="r2 last">lib/time-lord.rb</dd>
78
+
79
+ </dl>
80
+ <div class="clear"></div>
81
+
82
+
83
+ <h2>Constant Summary</h2>
84
+
85
+ <dl class="constants">
86
+
87
+ <dt id="Second-constant" class="">Second =
88
+
89
+ </dt>
90
+ <dd><pre class="code"><span class='int'>1</span></pre></dd>
91
+
92
+ <dt id="Minute-constant" class="">Minute =
93
+
94
+ </dt>
95
+ <dd><pre class="code"><span class='const'>Second</span> <span class='op'>*</span> <span class='int'>60</span></pre></dd>
96
+
97
+ <dt id="Hour-constant" class="">Hour =
98
+
99
+ </dt>
100
+ <dd><pre class="code"><span class='const'>Minute</span> <span class='op'>*</span> <span class='int'>60</span></pre></dd>
101
+
102
+ <dt id="Day-constant" class="">Day =
103
+
104
+ </dt>
105
+ <dd><pre class="code"><span class='const'>Hour</span> <span class='op'>*</span> <span class='int'>24</span></pre></dd>
106
+
107
+ <dt id="Week-constant" class="">Week =
108
+
109
+ </dt>
110
+ <dd><pre class="code"><span class='const'>Day</span> <span class='op'>*</span> <span class='int'>7</span></pre></dd>
111
+
112
+ <dt id="Fortnight-constant" class="">Fortnight =
113
+
114
+ </dt>
115
+ <dd><pre class="code"><span class='const'>Week</span> <span class='op'>*</span> <span class='int'>2</span></pre></dd>
116
+
117
+ <dt id="Month-constant" class="">Month =
118
+
119
+ </dt>
120
+ <dd><pre class="code"><span class='const'>Week</span> <span class='op'>*</span> <span class='int'>4</span></pre></dd>
121
+
122
+ <dt id="Quarter-constant" class="">Quarter =
123
+
124
+ </dt>
125
+ <dd><pre class="code"><span class='const'>Month</span> <span class='op'>*</span> <span class='int'>3</span></pre></dd>
126
+
127
+ <dt id="Year-constant" class="">Year =
128
+
129
+ </dt>
130
+ <dd><pre class="code"><span class='const'>Month</span> <span class='op'>*</span> <span class='int'>12</span></pre></dd>
131
+
132
+ <dt id="Olympiad-constant" class="">Olympiad =
133
+
134
+ </dt>
135
+ <dd><pre class="code"><span class='const'>Year</span> <span class='op'>*</span> <span class='int'>4</span></pre></dd>
136
+
137
+ <dt id="Lustrum-constant" class="">Lustrum =
138
+
139
+ </dt>
140
+ <dd><pre class="code"><span class='const'>Year</span> <span class='op'>*</span> <span class='int'>5</span></pre></dd>
141
+
142
+ <dt id="Decade-constant" class="">Decade =
143
+
144
+ </dt>
145
+ <dd><pre class="code"><span class='const'>Year</span> <span class='op'>*</span> <span class='int'>10</span></pre></dd>
146
+
147
+ <dt id="Indiction-constant" class="">Indiction =
148
+
149
+ </dt>
150
+ <dd><pre class="code"><span class='const'>Year</span> <span class='op'>*</span> <span class='int'>15</span></pre></dd>
151
+
152
+ <dt id="Jubilee-constant" class="">Jubilee =
153
+
154
+ </dt>
155
+ <dd><pre class="code"><span class='const'>Decade</span> <span class='op'>*</span> <span class='int'>5</span></pre></dd>
156
+
157
+ <dt id="Century-constant" class="">Century =
158
+
159
+ </dt>
160
+ <dd><pre class="code"><span class='const'>Decade</span> <span class='op'>*</span> <span class='int'>10</span></pre></dd>
161
+
162
+ <dt id="Millennium-constant" class="">Millennium =
163
+
164
+ </dt>
165
+ <dd><pre class="code"><span class='const'>Century</span> <span class='op'>*</span> <span class='int'>10</span></pre></dd>
166
+
167
+ <dt id="Eon-constant" class="">Eon =
168
+
169
+ </dt>
170
+ <dd><pre class="code"><span class='float'>1.0</span><span class='op'>/</span><span class='int'>0</span></pre></dd>
171
+
172
+ </dl>
173
+
174
+
175
+
176
+
177
+
178
+ <h2>
179
+ Instance Method Summary
180
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
181
+ </h2>
182
+
183
+ <ul class="summary">
184
+
185
+ <li class="public ">
186
+ <span class="summary_signature">
187
+
188
+ <a href="#ago_in_words-instance_method" title="#ago_in_words (instance method)">- (Object) <strong>ago_in_words</strong> </a>
189
+
190
+
191
+
192
+ (also: #time_ago_in_words)
193
+
194
+ </span>
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+ <span class="summary_desc"><div class='inline'></div></span>
204
+
205
+ </li>
206
+
207
+
208
+ </ul>
209
+
210
+
211
+
212
+
213
+ <div id="instance_method_details" class="method_details_list">
214
+ <h2>Instance Method Details</h2>
215
+
216
+
217
+ <div class="method_details first">
218
+ <p class="signature first" id="ago_in_words-instance_method">
219
+
220
+ - (<tt>Object</tt>) <strong>ago_in_words</strong>
221
+
222
+
223
+
224
+ <span class="aliases">Also known as:
225
+ <span class="names"><span id='time_ago_in_words-instance_method'>time_ago_in_words</span></span>
226
+ </span>
227
+
228
+ </p><table class="source_code">
229
+ <tr>
230
+ <td>
231
+ <pre class="lines">
232
+
233
+
234
+ 22
235
+ 23
236
+ 24
237
+ 25
238
+ 26
239
+ 27
240
+ 28
241
+ 29
242
+ 30
243
+ 31
244
+ 32
245
+ 33
246
+ 34
247
+ 35
248
+ 36
249
+ 37
250
+ 38
251
+ 39</pre>
252
+ </td>
253
+ <td>
254
+ <pre class="code"><span class="info file"># File 'lib/time-lord.rb', line 22</span>
255
+
256
+ <span class='kw'>def</span> <span class='id ago_in_words'>ago_in_words</span>
257
+
258
+ <span class='comment'># Find the time difference between the time provided and the current time.
259
+ </span> <span class='id difference'>difference</span> <span class='op'>=</span> <span class='id get_time_difference_from'>get_time_difference_from</span> <span class='kw'>self</span>
260
+
261
+ <span class='comment'># Catch less than 1 second differences.
262
+ </span> <span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>just now</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id difference'>difference</span> <span class='op'>&lt;</span> <span class='int'>1</span>
263
+
264
+ <span class='id name'>name</span> <span class='op'>=</span> <span class='id get_unit_name_from'>get_unit_name_from</span> <span class='id difference'>difference</span>
265
+ <span class='id amount'>amount</span> <span class='op'>=</span> <span class='id get_unit_amount_from'>get_unit_amount_from</span> <span class='id difference'>difference</span>
266
+ <span class='id count'>count</span> <span class='op'>=</span> <span class='id get_unit_count_from'>get_unit_count_from</span> <span class='id difference'>difference</span><span class='comma'>,</span> <span class='id amount'>amount</span>
267
+
268
+ <span class='comment'># Determine if unit name needs pluralization.
269
+ </span> <span class='id name'>name</span> <span class='op'>+=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>s</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id count'>count</span> <span class='op'>&gt;</span> <span class='int'>1</span>
270
+
271
+ <span class='comment'># Return the remaining string.
272
+ </span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id count'>count</span><span class='rbrace'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id name'>name</span><span class='rbrace'>}</span><span class='tstring_content'> ago</span><span class='tstring_end'>&quot;</span></span>
273
+ <span class='kw'>end</span></pre>
274
+ </td>
275
+ </tr>
276
+ </table>
277
+ </div>
278
+
279
+ </div>
280
+
281
+ </div>
282
+
283
+ <div id="footer">
284
+ Generated on Wed Mar 16 02:14:43 2011 by
285
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
286
+ 0.6.5 (ruby-1.9.2).
287
+ </div>
288
+
289
+ </body>
290
+ </html>