timelord 0.0.1 → 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.
Files changed (3) hide show
  1. data/Rakefile +11 -1
  2. data/lib/timelord.rb +7 -0
  3. metadata +4 -4
data/Rakefile CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'rake'
2
2
  require 'spec/rake/spectask'
3
+ require 'rake/rdoctask'
3
4
  require 'yaml'
4
5
 
5
6
  Spec::Rake::SpecTask.new do |t|
@@ -13,7 +14,7 @@ PKG_FILES = %w(Rakefile) + Dir.glob("{lib}/**/*")
13
14
 
14
15
  gem_spec = Gem::Specification.new do |spec|
15
16
  spec.name = 'timelord'
16
- spec.version = '0.0.1'
17
+ spec.version = '0.0.3'
17
18
  spec.summary = 'Pull dates out of strings'
18
19
  spec.description = 'Pull dates out of strings.'
19
20
  spec.email = 'halogenandtoast@gmail.com'
@@ -28,3 +29,12 @@ task :gemspec do
28
29
  f.write gem_spec.to_yaml
29
30
  end
30
31
  end
32
+
33
+ desc 'Generate documentation'
34
+ Rake::RDocTask.new(:rdoc) do |rdoc|
35
+ rdoc.rdoc_dir = 'doc'
36
+ rdoc.title = 'Timelord'
37
+ rdoc.options << '--line-numbers' << '--inline-source'
38
+ rdoc.rdoc_files.include('README*')
39
+ rdoc.rdoc_files.include('lib/**/*.rb')
40
+ end
data/lib/timelord.rb CHANGED
@@ -8,6 +8,13 @@ class Timelord
8
8
  DAY_NAMES = %w(monday tuesday wednesday thursday friday saturday sunday).freeze
9
9
  DAY_MATCHER = DAY_NAMES.join('|').freeze
10
10
 
11
+ # Parses a date str. Second parameter switches between international and american date formats.
12
+ #
13
+ # Timelord.parse("Tuesday").to_s # "2011-01-04"
14
+ # Timelord.parse("11/01").to_s # "2011-01-11"
15
+ # Timelord.parse("11/01", :american) # "2011-11-01"
16
+ #
17
+ # For more examples, check out the spec[https://github.com/halogenandtoast/timelord/blob/master/spec/timelord_spec.rb]
11
18
  def self.parse(str, format = :international)
12
19
  today = Date.today
13
20
  if str =~ /(\d{4})\/(\d{1,2})\/(\d{1,2})/i
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timelord
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matthew Mongeau
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-02 00:00:00 -05:00
18
+ date: 2011-01-03 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies: []
21
21