dater 0.2.4 → 0.2.5

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.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dater (0.2.4)
4
+ dater (0.2.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -22,7 +22,8 @@ module Dater
22
22
  #
23
23
  # @param [String] format = date format
24
24
  # @param [String] lang = languaje for matching (en=english, es=spanish, pt=portuguese)
25
- def initialize(format='%Y-%m-%d', lang="en")
25
+ def initialize(format='%Y-%m-%d', lang="en", today_for_nil=false)
26
+ @today_for_nil=today_for_nil
26
27
  @format=format
27
28
  @lang=lang if ["en","es","pt"].include? lang
28
29
  end
@@ -32,7 +33,9 @@ module Dater
32
33
  # @param [String] period = a period of time like "in 3 days" or "in 10 months" or "in 2 years". It could be a formatted date to convert to the wanted format
33
34
  # @return [String] converted date to the configured format. If period is nil, returns date for tomorrow
34
35
  def for(period=nil)
35
- return (Time.now).strftime(@format) if period.nil?
36
+ if period.nil?
37
+ return @today_for_nil ? (Time.now).strftime(@format) : nil
38
+ end
36
39
  @date=case period.downcase
37
40
  when DICTIONARY[:today][@lang]
38
41
  self.today(false)
@@ -1,3 +1,3 @@
1
1
  module Dater
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dater
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-09 00:00:00.000000000 Z
12
+ date: 2013-09-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler