datet 0.0.19 → 0.0.20

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -8,7 +8,7 @@ GEM
8
8
  git (>= 1.2.5)
9
9
  rake
10
10
  rdoc
11
- json (1.7.4)
11
+ json (1.7.5)
12
12
  rake (0.9.2.2)
13
13
  rdoc (3.12)
14
14
  json (~> 1.4)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.19
1
+ 0.0.20
data/datet.gemspec CHANGED
@@ -4,14 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{datet}
8
- s.version = "0.0.19"
7
+ s.name = "datet"
8
+ s.version = "0.0.20"
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-08-29}
13
- s.description = %q{A framework for handeling date- and time-related stuff in Ruby.}
14
- s.email = %q{k@spernj.org}
12
+ s.date = "2012-09-08"
13
+ s.description = "A framework for handeling date- and time-related stuff in Ruby."
14
+ s.email = "k@spernj.org"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
17
  "README.rdoc"
@@ -30,11 +30,11 @@ Gem::Specification.new do |s|
30
30
  "spec/datet_spec.rb",
31
31
  "spec/spec_helper.rb"
32
32
  ]
33
- s.homepage = %q{http://github.com/kaspernj/datet}
33
+ s.homepage = "http://github.com/kaspernj/datet"
34
34
  s.licenses = ["MIT"]
35
35
  s.require_paths = ["lib"]
36
- s.rubygems_version = %q{1.6.2}
37
- s.summary = %q{A framework for handeling date- and time-related stuff in Ruby.}
36
+ s.rubygems_version = "1.8.24"
37
+ s.summary = "A framework for handeling date- and time-related stuff in Ruby."
38
38
 
39
39
  if s.respond_to? :specification_version then
40
40
  s.specification_version = 3
data/lib/datet.rb CHANGED
@@ -1126,6 +1126,11 @@ class Datet
1126
1126
  raise ArgumentError, "Wrong format: '#{timestr}', class: '#{timestr.class.name}'"
1127
1127
  end
1128
1128
 
1129
+ #Creates a new Datet-object from the given Unix Timestamp.
1130
+ def self.from_ut(unix_timestamp)
1131
+ return Datet.new(Time.at(unix_timestamp.to_i))
1132
+ end
1133
+
1129
1134
  #Returns a hash with the month-no as key and month-name as value. It uses the method "_" to translate the months names. So GetText or another method has to be defined.
1130
1135
  def self.months(args = nil)
1131
1136
  if args
data/spec/datet_spec.rb CHANGED
@@ -535,5 +535,12 @@ describe "Datet" do
535
535
  datet = Datet.random(:years => years_r)
536
536
  raise "Expected year to be within range: '#{datet.year}' '#{years_r}'." if !years_r.member?(datet.year)
537
537
  end
538
+
539
+ 1.upto(100) do
540
+ datet = Datet.random(years: 1..1, months: 3..5, days: 20..25)
541
+ raise "Expected year 1 but got: '#{datet.year}'." if datet.year != 1
542
+ raise "Expected month between 3 and 5 but it wasnt: '#{datet.month}'." if datet.month < 3 or datet.month > 5
543
+ raise "Expected day between 20 and 25 but got: '#{datet.day}'." if datet.day < 20 or datet.day > 25
544
+ end
538
545
  end
539
546
  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.19
5
+ version: 0.0.20
6
6
  platform: ruby
7
7
  authors:
8
8
  - Kasper Johansen
@@ -10,8 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-08-29 00:00:00 +02:00
14
- default_executable:
13
+ date: 2012-09-08 00:00:00 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: rspec
@@ -79,7 +78,6 @@ files:
79
78
  - lib/datet.rb
80
79
  - spec/datet_spec.rb
81
80
  - spec/spec_helper.rb
82
- has_rdoc: true
83
81
  homepage: http://github.com/kaspernj/datet
84
82
  licenses:
85
83
  - MIT
@@ -93,7 +91,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
93
91
  requirements:
94
92
  - - ">="
95
93
  - !ruby/object:Gem::Version
96
- hash: -585524572600790953
94
+ hash: 4232658486024681942
97
95
  segments:
98
96
  - 0
99
97
  version: "0"
@@ -106,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
104
  requirements: []
107
105
 
108
106
  rubyforge_project:
109
- rubygems_version: 1.6.2
107
+ rubygems_version: 1.8.24
110
108
  signing_key:
111
109
  specification_version: 3
112
110
  summary: A framework for handeling date- and time-related stuff in Ruby.