multiparameter_date_time 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2d717719290be36be6c8d1fb0ff2741e93bb338a
4
- data.tar.gz: 5c2fda8d5e8ecd689d617b19915a9e4e2575a8f8
3
+ metadata.gz: fc63493a635ad27f89775a40b7341fa1c5d7dae1
4
+ data.tar.gz: f0925022123dbae27fc5093a060fbca253f45feb
5
5
  SHA512:
6
- metadata.gz: 7aa475440b63e652a9f1fe34dc15e4f6adf957ce297c6b1ba98a03edca3001e77583d49259e019fc33c89ea4b28b2105e4290f4a041a122e98589eb757352d46
7
- data.tar.gz: 14361fd03a3053ad5ab0b61361ea0e199d82e6ebb14d5c8baee46afc36a42ac2ca56a1484d5c91f48e6df694ba3be7832b5ff13d0edc6cc3321980d1b3f1e2f0
6
+ metadata.gz: e9fb1385f8e7def9fbb7a99f2a8920e9cddc845c559bf4fa31aea171b8cddde7eea602f4dc501d25ea901ed82e7dd0b7c86b3446e3ce41fa31d1986b0ea0633c
7
+ data.tar.gz: b731a1ff6cbbd8a8b1cc21ec1c9cdab30afc0d6f1fe8afe8a5060948da84ca3b8f57223c63c7e013527e3e9a04357870ece28b40f6aa760f3483170d4a064bd5
@@ -1,3 +1,3 @@
1
1
  module MultiparameterDateTime
2
- VERSION = '0.1.1'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -33,7 +33,15 @@ module MultiparameterDateTime
33
33
  time_part_setter = :"#{time_attribute}="
34
34
 
35
35
  define_method "#{attribute_name}=" do |date_time_input|
36
- date_time_input = date_time_input.to_time_in_current_zone if date_time_input.respond_to?(:to_time_in_current_zone)
36
+ begin
37
+ if date_time_input.respond_to?(:in_time_zone)
38
+ date_time_input = date_time_input.in_time_zone
39
+ elsif date_time_input.respond_to?(:to_time_in_current_zone)
40
+ date_time_input = date_time_input.to_time_in_current_zone
41
+ end
42
+ rescue ArgumentError
43
+ end
44
+
37
45
  if date_time_input.is_a?(String)
38
46
  iso8601 = Time.iso8601(date_time_input).in_time_zone(Time.zone) rescue nil
39
47
  if iso8601
@@ -18,10 +18,9 @@ Gem::Specification.new do |gem|
18
18
  gem.required_ruby_version = '>= 1.9.2'
19
19
 
20
20
  gem.add_dependency 'american_date'
21
+ gem.add_dependency 'activesupport', '~> 4.0'
21
22
 
22
23
  gem.add_development_dependency 'activerecord'
23
- gem.add_development_dependency 'activesupport'
24
24
  gem.add_development_dependency 'rspec', '~> 2.11'
25
- gem.add_development_dependency 'with_model', "~> 0.3"
26
- gem.add_development_dependency 'informal', "~> 0.1.0"
25
+ gem.add_development_dependency 'with_model', '~> 1.0'
27
26
  end
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  require 'multiparameter_date_time'
4
- require 'informal'
5
4
  require 'active_support/core_ext/time/zones'
6
5
  require 'is_valid_multiparameter_date_time_validator'
7
6
 
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  require 'multiparameter_date_time'
4
- require 'informal'
5
4
  require 'active_support/core_ext/time/zones'
6
5
 
7
6
  describe MultiparameterDateTime do
@@ -21,7 +20,7 @@ describe MultiparameterDateTime do
21
20
  end
22
21
 
23
22
  class ActiveModelWithDateTime
24
- include Informal::Model
23
+ include ActiveModel::Model
25
24
  attr_accessor :foo
26
25
  include MultiparameterDateTime
27
26
  multiparameter_date_time :foo
@@ -267,11 +266,11 @@ describe MultiparameterDateTime do
267
266
  end
268
267
 
269
268
  it "sets the attribute to a DateTime object" do
270
- subject.foo.should == Time.zone.parse('01/01/2000 12:30pm')
269
+ subject.foo.should == Time.zone.parse('1/1/2000 12:30pm')
271
270
  end
272
271
 
273
272
  it "has the original date" do
274
- subject.foo_date_part.should == '01/01/2000'
273
+ subject.foo_date_part.should == '1/1/2000'
275
274
  end
276
275
 
277
276
  it "has the original time" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multiparameter_date_time
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Case Commons, LLC
@@ -11,92 +11,78 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-11-19 00:00:00.000000000 Z
14
+ date: 2014-07-07 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: american_date
18
18
  requirement: !ruby/object:Gem::Requirement
19
19
  requirements:
20
- - - '>='
20
+ - - ">="
21
21
  - !ruby/object:Gem::Version
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - '>='
27
+ - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
30
  - !ruby/object:Gem::Dependency
31
- name: activerecord
31
+ name: activesupport
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
- - - '>='
34
+ - - "~>"
35
35
  - !ruby/object:Gem::Version
36
- version: '0'
37
- type: :development
36
+ version: '4.0'
37
+ type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - '>='
41
+ - - "~>"
42
42
  - !ruby/object:Gem::Version
43
- version: '0'
43
+ version: '4.0'
44
44
  - !ruby/object:Gem::Dependency
45
- name: activesupport
45
+ name: activerecord
46
46
  requirement: !ruby/object:Gem::Requirement
47
47
  requirements:
48
- - - '>='
48
+ - - ">="
49
49
  - !ruby/object:Gem::Version
50
50
  version: '0'
51
51
  type: :development
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
- - - '>='
55
+ - - ">="
56
56
  - !ruby/object:Gem::Version
57
57
  version: '0'
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rspec
60
60
  requirement: !ruby/object:Gem::Requirement
61
61
  requirements:
62
- - - ~>
62
+ - - "~>"
63
63
  - !ruby/object:Gem::Version
64
64
  version: '2.11'
65
65
  type: :development
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - ~>
69
+ - - "~>"
70
70
  - !ruby/object:Gem::Version
71
71
  version: '2.11'
72
72
  - !ruby/object:Gem::Dependency
73
73
  name: with_model
74
74
  requirement: !ruby/object:Gem::Requirement
75
75
  requirements:
76
- - - ~>
77
- - !ruby/object:Gem::Version
78
- version: '0.3'
79
- type: :development
80
- prerelease: false
81
- version_requirements: !ruby/object:Gem::Requirement
82
- requirements:
83
- - - ~>
84
- - !ruby/object:Gem::Version
85
- version: '0.3'
86
- - !ruby/object:Gem::Dependency
87
- name: informal
88
- requirement: !ruby/object:Gem::Requirement
89
- requirements:
90
- - - ~>
76
+ - - "~>"
91
77
  - !ruby/object:Gem::Version
92
- version: 0.1.0
78
+ version: '1.0'
93
79
  type: :development
94
80
  prerelease: false
95
81
  version_requirements: !ruby/object:Gem::Requirement
96
82
  requirements:
97
- - - ~>
83
+ - - "~>"
98
84
  - !ruby/object:Gem::Version
99
- version: 0.1.0
85
+ version: '1.0'
100
86
  description:
101
87
  email:
102
88
  - casecommons-dev@googlegroups.com
@@ -107,8 +93,8 @@ executables: []
107
93
  extensions: []
108
94
  extra_rdoc_files: []
109
95
  files:
110
- - .gitignore
111
- - .travis.yml
96
+ - ".gitignore"
97
+ - ".travis.yml"
112
98
  - Gemfile
113
99
  - LICENSE
114
100
  - README.md
@@ -130,17 +116,17 @@ require_paths:
130
116
  - lib
131
117
  required_ruby_version: !ruby/object:Gem::Requirement
132
118
  requirements:
133
- - - '>='
119
+ - - ">="
134
120
  - !ruby/object:Gem::Version
135
121
  version: 1.9.2
136
122
  required_rubygems_version: !ruby/object:Gem::Requirement
137
123
  requirements:
138
- - - '>='
124
+ - - ">="
139
125
  - !ruby/object:Gem::Version
140
126
  version: '0'
141
127
  requirements: []
142
128
  rubyforge_project:
143
- rubygems_version: 2.0.3
129
+ rubygems_version: 2.2.2
144
130
  signing_key:
145
131
  specification_version: 4
146
132
  summary: Set a DateTime via two accessors, one for the date, one for the time
@@ -148,3 +134,4 @@ test_files:
148
134
  - spec/is_valid_multiparameter_date_time_validator_spec.rb
149
135
  - spec/multiparameter_date_time_spec.rb
150
136
  - spec/spec_helper.rb
137
+ has_rdoc: