string_date_accessors 0.0.7 → 0.0.8
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.
- data/VERSION +1 -1
- data/lib/string_date_accessors.rb +2 -1
- data/spec/string_date_accessors_spec.rb +23 -6
- data/string_date_accessors.gemspec +4 -4
- metadata +11 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.8
|
@@ -51,7 +51,8 @@ module StringDateAccessors
|
|
51
51
|
if input.respond_to?(:strftime)
|
52
52
|
super input
|
53
53
|
elsif input.nil? || input.empty?
|
54
|
-
|
54
|
+
value = super(nil)
|
55
|
+
return value # don't mark as set
|
55
56
|
else
|
56
57
|
super StringDateAccessors.formatted(input)
|
57
58
|
end
|
@@ -34,15 +34,32 @@ describe StringDateAccessors do
|
|
34
34
|
context "entering time strings with slashes" do
|
35
35
|
subject do
|
36
36
|
inheritor = StringDateInheritor.new
|
37
|
-
|
37
|
+
|
38
|
+
offset = Time.zone_offset(Time.now.zone)
|
39
|
+
|
40
|
+
@utc_min = 3
|
41
|
+
@utc_hour = 15
|
42
|
+
@utc_day = 11
|
43
|
+
@utc_month = 12
|
44
|
+
@utc_year = 2009
|
45
|
+
|
46
|
+
@dt = DateTime.new(@utc_year,
|
47
|
+
@utc_month,
|
48
|
+
@utc_day,
|
49
|
+
@utc_hour,
|
50
|
+
@utc_min).utc + offset.seconds
|
51
|
+
|
52
|
+
string_to_set = "#{@dt.day}/#{@dt.month}/#{@dt.year.to_s[2..3]} #{@dt.hour}:#{@dt.min}"
|
53
|
+
|
54
|
+
inheritor.punched_on = string_to_set
|
38
55
|
inheritor.punched_on
|
39
56
|
end
|
40
57
|
|
41
|
-
its(:min) { should ==
|
42
|
-
its(:hour) { should ==
|
43
|
-
its(:day) { should ==
|
44
|
-
its(:month) { should ==
|
45
|
-
its(:year) { should ==
|
58
|
+
its(:min) { should == @utc_min }
|
59
|
+
its(:hour) { should == @utc_hour }
|
60
|
+
its(:day) { should == @utc_day }
|
61
|
+
its(:month) { should == @utc_month }
|
62
|
+
its(:year) { should == @utc_year }
|
46
63
|
it { should be_a(Time) }
|
47
64
|
end
|
48
65
|
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{string_date_accessors}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.8"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Andrew Bruce"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-12-09}
|
13
13
|
s.description = %q{
|
14
14
|
This gem is useful if you don't want to use Rails' standard date helpers and would rather
|
15
15
|
set a text format for reading and writing dates.
|
@@ -35,7 +35,7 @@ Gem::Specification.new do |s|
|
|
35
35
|
s.homepage = %q{http://github.com/camelpunch/string_date_accessors}
|
36
36
|
s.rdoc_options = ["--charset=UTF-8"]
|
37
37
|
s.require_paths = ["lib"]
|
38
|
-
s.rubygems_version = %q{1.3.
|
38
|
+
s.rubygems_version = %q{1.3.7}
|
39
39
|
s.summary = %q{Get and set dates as strings on ActiveRecord-like objects}
|
40
40
|
s.test_files = [
|
41
41
|
"spec/spec_helper.rb",
|
@@ -46,7 +46,7 @@ Gem::Specification.new do |s|
|
|
46
46
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
47
47
|
s.specification_version = 3
|
48
48
|
|
49
|
-
if Gem::Version.new(Gem::
|
49
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
50
50
|
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
51
51
|
else
|
52
52
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: string_date_accessors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 15
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
9
|
+
- 8
|
10
|
+
version: 0.0.8
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Andrew Bruce
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-12-09 00:00:00 +00:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: rspec
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 13
|
27
30
|
segments:
|
28
31
|
- 1
|
29
32
|
- 2
|
@@ -62,23 +65,27 @@ rdoc_options:
|
|
62
65
|
require_paths:
|
63
66
|
- lib
|
64
67
|
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
65
69
|
requirements:
|
66
70
|
- - ">="
|
67
71
|
- !ruby/object:Gem::Version
|
72
|
+
hash: 3
|
68
73
|
segments:
|
69
74
|
- 0
|
70
75
|
version: "0"
|
71
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
72
78
|
requirements:
|
73
79
|
- - ">="
|
74
80
|
- !ruby/object:Gem::Version
|
81
|
+
hash: 3
|
75
82
|
segments:
|
76
83
|
- 0
|
77
84
|
version: "0"
|
78
85
|
requirements: []
|
79
86
|
|
80
87
|
rubyforge_project:
|
81
|
-
rubygems_version: 1.3.
|
88
|
+
rubygems_version: 1.3.7
|
82
89
|
signing_key:
|
83
90
|
specification_version: 3
|
84
91
|
summary: Get and set dates as strings on ActiveRecord-like objects
|