12_hour_time 0.0.3 → 0.0.4
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/lib/12_hour_time/active_record_modifications.rb +12 -23
- data/lib/12_hour_time/version.rb +1 -1
- metadata +21 -43
@@ -1,28 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
hour_idx = ActionView::Helpers::DateTimeSelector::POSITION[:hour] - 1
|
11
|
-
ampm = values.pop
|
12
|
-
if ampm == ActionView::Helpers::DateTimeSelector::AM and values[hour_idx] == 12
|
13
|
-
values[hour_idx] = 0
|
14
|
-
elsif ampm == ActionView::Helpers::DateTimeSelector::PM and values[hour_idx] != 12
|
15
|
-
values[hour_idx] += 12
|
16
|
-
end
|
17
|
-
end
|
18
|
-
super
|
1
|
+
class ActiveRecord::Base
|
2
|
+
def instantiate_time_object_with_ampm(name, values)
|
3
|
+
if values.last < 0
|
4
|
+
hour_idx = ActionView::Helpers::DateTimeSelector::POSITION[:hour] - 1
|
5
|
+
ampm = values.pop
|
6
|
+
if ampm == ActionView::Helpers::DateTimeSelector::AM and values[hour_idx] == 12
|
7
|
+
values[hour_idx] = 0
|
8
|
+
elsif ampm == ActionView::Helpers::DateTimeSelector::PM and values[hour_idx] != 12
|
9
|
+
values[hour_idx] += 12
|
19
10
|
end
|
20
11
|
end
|
21
|
-
end
|
22
|
-
end
|
23
12
|
|
24
|
-
|
25
|
-
ActiveRecord::Base.class_eval do
|
26
|
-
include TwelveHourTime::AR
|
13
|
+
instantiate_time_object_without_ampm(name, values)
|
27
14
|
end
|
15
|
+
|
16
|
+
alias_method_chain :instantiate_time_object, :ampm
|
28
17
|
end
|
data/lib/12_hour_time/version.rb
CHANGED
metadata
CHANGED
@@ -1,74 +1,52 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: 12_hour_time
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 3
|
9
|
-
version: 0.0.3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Nick Muerdter
|
13
9
|
- Maurice Aubrey
|
14
10
|
autorequire:
|
15
11
|
bindir: bin
|
16
12
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2010-11-23 00:00:00 -08:00
|
19
|
-
default_executable:
|
13
|
+
date: 2011-11-16 00:00:00.000000000Z
|
20
14
|
dependencies: []
|
21
|
-
|
22
15
|
description: AM/PM 12 Hour Time Helper
|
23
|
-
email:
|
16
|
+
email:
|
24
17
|
- samer@abukhait.com
|
25
18
|
executables: []
|
26
|
-
|
27
19
|
extensions: []
|
28
|
-
|
29
20
|
extra_rdoc_files: []
|
30
|
-
|
31
|
-
|
32
|
-
- lib/12_hour_time.rb
|
21
|
+
files:
|
22
|
+
- lib/12_hour_time/action_view_helpers.rb
|
33
23
|
- lib/12_hour_time/active_record_modifications.rb
|
34
24
|
- lib/12_hour_time/awesome.rb
|
35
25
|
- lib/12_hour_time/version.rb
|
36
|
-
- lib/12_hour_time
|
26
|
+
- lib/12_hour_time.rb
|
37
27
|
- LICENSE
|
38
|
-
has_rdoc: true
|
39
28
|
homepage: http://github.com/abukhait/12_hour_time
|
40
29
|
licenses: []
|
41
|
-
|
42
30
|
post_install_message:
|
43
31
|
rdoc_options: []
|
44
|
-
|
45
|
-
require_paths:
|
32
|
+
require_paths:
|
46
33
|
- lib
|
47
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
34
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
35
|
none: false
|
49
|
-
requirements:
|
50
|
-
- -
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
|
53
|
-
|
54
|
-
- 0
|
55
|
-
version: "0"
|
56
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ! '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
41
|
none: false
|
58
|
-
requirements:
|
59
|
-
- -
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
segments:
|
62
|
-
- 1
|
63
|
-
- 3
|
64
|
-
- 7
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
65
45
|
version: 1.3.7
|
66
46
|
requirements: []
|
67
|
-
|
68
47
|
rubyforge_project: 12_hour_time
|
69
|
-
rubygems_version: 1.
|
48
|
+
rubygems_version: 1.8.11
|
70
49
|
signing_key:
|
71
50
|
specification_version: 3
|
72
51
|
summary: 12 Hour Time
|
73
52
|
test_files: []
|
74
|
-
|