stamp 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -6,4 +6,3 @@ rvm:
6
6
  - rbx-2.0
7
7
  - jruby
8
8
  - ruby-head
9
- - 1.8.6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stamp (0.1.1)
4
+ stamp (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # stamp
2
2
 
3
- Format dates (and times, soon) based on examples, not arcane strftime directives.
3
+ Format dates (and times, soon) based on human-friendly examples, not arcane
4
+ strftime directives.
4
5
 
5
6
  [![Build Status](http://travis-ci.org/jeremyw/stamp.png)](http://travis-ci.org/jeremyw/stamp)
6
7
 
@@ -10,9 +11,12 @@ Just `gem install stamp`, or add stamp to your Gemfile and `bundle install`.
10
11
 
11
12
  ## Usage
12
13
 
13
- Date objects get a powerful new method: #stamp. Provide an example date string
14
- with whatever month, day, year, and weekday parts you'd like, and your date
15
- will be formatted accordingly:
14
+ Your Ruby dates and times get a powerful new method: `stamp`.
15
+
16
+ ### Dates
17
+
18
+ Give `Date#stamp` an example date string with whatever month, day, year,
19
+ and weekday parts you'd like, and your date will be formatted accordingly:
16
20
 
17
21
  ```ruby
18
22
  date = Date.new(2011, 6, 9)
@@ -25,7 +29,21 @@ date.stamp("12/31/99") # "06/09/11"
25
29
  date.stamp("DOB: 12/31/2000") # "DOB: 06/09/2011"
26
30
  ```
27
31
 
28
- ### Features
32
+ ### Times
33
+
34
+ `Time#stamp` supports the same kinds of examples as `Date`, but also formats
35
+ hours, minutes, and seconds when it sees colon-separated values:
36
+
37
+ ```ruby
38
+ time = Time.utc(2011, 6, 9, 20, 52, 30)
39
+ time.stamp("3:00 AM") # " 8:52 PM"
40
+ time.stamp("01:00:00 AM") # "08:52:30 PM"
41
+ time.stamp("23:59") # "20:52"
42
+ time.stamp("23:59:59") # "20:52:30"
43
+ time.stamp("Jan 1 at 01:00 AM") # "Jun 9 at 08:52 PM"
44
+ ```
45
+
46
+ ## Features
29
47
 
30
48
  * Abbreviated and full names of months and weekdays are recognized.
31
49
  * Days with or without a leading zero work instinctively.
@@ -46,22 +64,19 @@ future understand your intent.
46
64
 
47
65
  ### Limitations
48
66
 
49
- * Support for time formatting by example is coming soon. Patches welcome!
50
-
51
- Did I mention? Patches welcome!
67
+ * Time zone support hasn't been implemented. Patches welcome!
68
+ * DateTime support hasn't been implemented. Patches welcome!
52
69
 
53
70
  If you need more obscure formatting options, you can include any valid
54
71
  [strftime](http://strfti.me) directives in your example string, and they'll
55
72
  just be passed along:
56
73
 
57
74
  ```ruby
58
- date.stamp("Week #%U, %Y") # "Week #23, 2011"
75
+ Date.today.stamp("Week #%U, 1999") # "Week #23, 2011"
59
76
  ````
60
77
 
61
78
  [Check out http://strfti.me](http://strfti.me) for more ideas.
62
79
 
63
- More coming soon, including time formats by example.
64
-
65
80
  ## Contributing to stamp
66
81
 
67
82
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
data/lib/stamp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Stamp
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 1
9
- version: 0.1.1
8
+ - 2
9
+ version: 0.1.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jeremy Weiskotten