datet 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.11
1
+ 0.0.12
data/datet.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{datet}
8
- s.version = "0.0.11"
8
+ s.version = "0.0.12"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kasper Johansen"]
12
- s.date = %q{2012-07-20}
12
+ s.date = %q{2012-07-22}
13
13
  s.description = %q{A framework for handeling date- and time-related stuff in Ruby.}
14
14
  s.email = %q{k@spernj.org}
15
15
  s.extra_rdoc_files = [
data/lib/datet.rb CHANGED
@@ -15,6 +15,7 @@ class Datet
15
15
  "apr" => 4,
16
16
  "april" => 4,
17
17
  "may" => 5,
18
+ "maj" => 5,
18
19
  "jun" => 6,
19
20
  "june" => 6,
20
21
  "jul" => 7,
@@ -24,7 +25,8 @@ class Datet
24
25
  "sep" => 9,
25
26
  "september" => 9,
26
27
  "oct" => 10,
27
- "october" => 11,
28
+ "october" => 10,
29
+ "okt" => 10,
28
30
  "nov" => 11,
29
31
  "november" => 11,
30
32
  "dec" => 12,
@@ -1230,7 +1232,7 @@ class Datet
1230
1232
  # Datet.month_str_to_no("DECEMBER") #=> 12
1231
1233
  # Datet.month_str_to_no("kasper") #=> <Error>-raised
1232
1234
  def self.month_str_to_no(str)
1233
- str = str.to_s.downcase.strip
1235
+ str = str.to_s.downcase.strip[0, 3].strip
1234
1236
  return @@months_lcase[str] if @@months_lcase.key?(str)
1235
1237
  raise ArgumentError, "No month to return from that string: '#{str}'."
1236
1238
  end
data/spec/datet_spec.rb CHANGED
@@ -491,4 +491,15 @@ describe "Datet" do
491
491
  datet.lazy_hour = -3
492
492
  raise "Expected time to be '1985-05-31 21:00:00' but it was: '#{datet.dbstr}'." if datet.dbstr != "1985-05-31 21:00:00"
493
493
  end
494
+
495
+ it "should be able to handle danish month-names" do
496
+ months = ["januar", "februar", "marts", "april", "maj", "juni", "juli", "august", "september", "oktober", "november", "december"]
497
+ count = 0
498
+ months.each do |month|
499
+ count += 1
500
+
501
+ res = Datet.month_str_to_no(month)
502
+ raise "Expected res to be '#{count}' for '#{month}' but it was: '#{res}'." if res != count
503
+ end
504
+ end
494
505
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: datet
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.11
5
+ version: 0.0.12
6
6
  platform: ruby
7
7
  authors:
8
8
  - Kasper Johansen
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-07-20 00:00:00 +02:00
13
+ date: 2012-07-22 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -93,7 +93,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
- hash: 762753016854982512
96
+ hash: 2555920573622116618
97
97
  segments:
98
98
  - 0
99
99
  version: "0"