theampm 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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDljZmJmOTI0YmVmNDdmYTcxOTcxNjFjZjA3OWI1ZDVhMmJhNGQwYg==
4
+ OWMxNmRlYWMwN2RiZGFmMTA4MzBjNDk3Zjk2Zjc1NjY5YWYwZTdmMg==
5
5
  data.tar.gz: !binary |-
6
- ZTkxNmUxN2MyZWNmZmU5MDJmZmFmODVkYTM0YjhkNGI2YTQ5MjdlYQ==
6
+ Njk2NTI3MzJhYmFkZDI5YWFhNDIwNDIzNTcwYTBkYTk5NmMwNDRkNw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MWU1MDFjNTUzYzEyOTRlMmE0ODUxNjAwMzBkODRkZWUxYTRmY2JhN2Y5NGIy
10
- ZTFlNTE5YjIyNDNmNDE2NGMyMWY1MDM1M2FlOGE2ZTY3YWJkZjFiOTQ5MmNk
11
- MjFlOGZkYTJlMTgzYmIwYWExZmM4NjI2MGM0OTZhZDQ5YzAzYmY=
9
+ ZDQ3MjY1YjVkZjg2ZWY3ODg3NjRlNGIxMmRiYmNjMzVmOGU2NzBiNmE4YjQx
10
+ MDU5ZmVmOTI5M2I0ODRkNGE2NjhjZTQ2MTQxN2QyYzcwMDE5YTdjMWU2ZTNm
11
+ ZmY2OGQ5MzAwNTg1NmUxZWExZWI1YmNjOWFjMzg1NzBlYzBkMjQ=
12
12
  data.tar.gz: !binary |-
13
- MmY0YjRlMjIzZjg5MzI2OTk3NTMxYjEyODZiYmU1MGY5NTdlMTlkZmI5OGY0
14
- OWEyZTc1MDFiYjkxZmNlZjEwN2U3MWIyMTYyYzQ1YjljYjljMDg5MDU5MDgw
15
- NDY3ZjFmM2NhYTNkZGY2OWRkYjFjMjE2M2UwOGUzYjMwNGJlOTU=
13
+ ZjFiMWViYWJjMmU1OTNiMzU0ZDQ5YWZkMzI5ZDYxYzYxN2RhOWU2OTZjMjI4
14
+ NjhhOGQzZmY2NjkwYTAxMjlkNDFlMjY5MGM4OWUzM2I5MmIyY2IxY2IxMjdh
15
+ ZDI5OTE0ODZhZGUzN2FiMGRmYzMxNDYwZTljNjM5ZmVlNzFkMzA=
data/README.md CHANGED
@@ -21,7 +21,7 @@ With theampm, write Time like this in Ruby:
21
21
  => 2013-10-08 15:15:00 -0500
22
22
  ```
23
23
 
24
- This code is so simple I debated even creating a gem for it, but I find myself creating it repeatedly for new projects, and now again for [Draft](http://draftin.com), an app to help people [write better](http://draftin.com).
24
+ This code is so simple I debated even creating a gem for it, but I find myself using it repeatedly for new projects, and now again for [Draft](http://draftin.com), an app to help people [write better](http://draftin.com).
25
25
 
26
26
 
27
27
  Installation
@@ -35,3 +35,6 @@ Installation
35
35
  Feedback
36
36
  --------
37
37
  [Source code available on Github](https://github.com/n8/theampm). Feedback and pull requests are greatly appreciated. Let me know if I can improve this.
38
+
39
+
40
+ P.S. [**I'd love to meet you on Twitter: here**](http://twitter.com/natekontny).
@@ -1,3 +1,3 @@
1
1
  module Theampm
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/theampm.rb CHANGED
@@ -4,21 +4,19 @@ require 'chronic'
4
4
  class Numeric
5
5
  # A convenience for writing: 3.am or 1130.am
6
6
  def am
7
- Chronic.parse("#{self.to_s} am")
7
+ Chronic.parse "#{self} am"
8
8
  end
9
9
 
10
10
  def pm
11
- Chronic.parse("#{self.to_s} pm")
11
+ Chronic.parse "#{self} pm"
12
12
  end
13
13
 
14
14
  def to_time
15
15
  hour = self
16
16
  if hour < 12 || (hour >= 100 && hour < 1200)
17
- Chronic.parse("#{self.to_s} am")
18
- elsif hour >= 24
19
- Chronic.parse("#{self.to_s}")
17
+ am
20
18
  else
21
- Chronic.parse("#{self.to_s} pm")
19
+ Chronic.parse hour.to_s
22
20
  end
23
21
  end
24
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: theampm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - nate
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-08 00:00:00.000000000 Z
11
+ date: 2013-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler