active_interaction 0.10.1 → 0.10.2

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: 1127329ea0197658f720d8fe6c1ae7d993f5f9dc
4
- data.tar.gz: 4b58e248170a453276474a749b109782e12501c8
3
+ metadata.gz: 88026615847767352e357dadf32abd0a6a114889
4
+ data.tar.gz: 5dd283e9aee1bab91a73ea20d52a7c8c24d5bed9
5
5
  SHA512:
6
- metadata.gz: b461f9b41d8dd0447c34b9c724b249ad62c29d4fe34c98f1a2e6965f99db9828a68b501d78b459d8dd1e24ccbf5ee03d3678d57b0a1182e7fdc0db3683f40bcb
7
- data.tar.gz: 745be14ea173b524346a1e38f9f89631b0e828db3c47ea3e543b4864c4df8929ea7fd2fb5cb5a44cc829d1bf1c4b0339b43faa657b65443a3ae5b954cc6e0b50
6
+ metadata.gz: 0d6082582172127078839165df075f8de2f222a3ed6822f52ad69270c6240e9d3f3eacfbfc95e3bd4989e21e43d371182b3ca1a09a9639ac14546d7c76b604d6
7
+ data.tar.gz: 6e81489a89de567be04f3f8713f88a0af5959de1fd2954b3731b1ce6ff7335615d423a59a428bd2081aa64a6a6dfede40e422005fbbb60cf3737f2a9e791ec31
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # [Master][]
2
2
 
3
+ # [0.10.2][] (2014-01-02)
4
+
5
+ - Fix a bug that marked Time instances as invalid if Time.zone was set.
6
+
3
7
  # [0.10.1][] (2013-12-20)
4
8
 
5
9
  - Fix bug that prevented parsing strings as times when ActiveSupport was
@@ -102,7 +106,8 @@
102
106
 
103
107
  - Initial release.
104
108
 
105
- [master]: https://github.com/orgsync/active_interaction/compare/v0.10.1...master
109
+ [master]: https://github.com/orgsync/active_interaction/compare/v0.10.2...master
110
+ [0.10.2]: https://github.com/orgsync/active_interaction/compare/v0.10.1...v0.10.2
106
111
  [0.10.1]: https://github.com/orgsync/active_interaction/compare/v0.10.0...v0.10.1
107
112
  [0.10.0]: https://github.com/orgsync/active_interaction/compare/v0.9.1...v0.10.0
108
113
  [0.9.1]: https://github.com/orgsync/active_interaction/compare/v0.9.0...v0.9.1
data/README.md CHANGED
@@ -25,7 +25,7 @@ This project uses [semantic versioning][].
25
25
  Add it to your Gemfile:
26
26
 
27
27
  ```ruby
28
- gem 'active_interaction', '~> 0.10.1'
28
+ gem 'active_interaction', '~> 0.10.2'
29
29
  ```
30
30
 
31
31
  And then execute:
@@ -31,7 +31,7 @@ require 'active_interaction/filters/time_filter'
31
31
  require 'active_interaction/base'
32
32
 
33
33
  I18n.backend.load_translations(
34
- Dir.glob(File.join(%w(lib active_interaction locale *.yml)))
34
+ Dir[File.join(%w(lib active_interaction locale *.yml))]
35
35
  )
36
36
 
37
37
  # @since 0.1.0
@@ -5,7 +5,7 @@ module ActiveInteraction
5
5
  class AbstractDateTimeFilter < Filter
6
6
  def cast(value)
7
7
  case value
8
- when value_class
8
+ when *klasses
9
9
  value
10
10
  when String
11
11
  begin
@@ -33,11 +33,11 @@ module ActiveInteraction
33
33
  end
34
34
 
35
35
  def klass
36
- fail NotImplementedError
36
+ self.class.slug.to_s.camelize.constantize
37
37
  end
38
38
 
39
- def value_class
40
- klass
39
+ def klasses
40
+ [klass]
41
41
  end
42
42
  end
43
43
  end
@@ -23,10 +23,5 @@ module ActiveInteraction
23
23
 
24
24
  # @private
25
25
  class DateFilter < AbstractDateTimeFilter
26
- private
27
-
28
- def klass
29
- Date
30
- end
31
26
  end
32
27
  end
@@ -11,10 +11,10 @@ module ActiveInteraction
11
11
  # @option options [String] :format parse strings using this format string
12
12
  #
13
13
  # @example
14
- # date :start_date
14
+ # date_time :start_date
15
15
  #
16
16
  # @example
17
- # date :start_date, format: '%Y-%m-%dT%H:%M:%S%:z'
17
+ # date_time :start_date, format: '%Y-%m-%dT%H:%M:%S%:z'
18
18
  #
19
19
  # @since 0.1.0
20
20
  #
@@ -23,10 +23,5 @@ module ActiveInteraction
23
23
 
24
24
  # @private
25
25
  class DateTimeFilter < AbstractDateTimeFilter
26
- private
27
-
28
- def klass
29
- DateTime
30
- end
31
26
  end
32
27
  end
@@ -15,7 +15,7 @@ module ActiveInteraction
15
15
  # time :start_date
16
16
  #
17
17
  # @example
18
- # date_time :start_date, format: '%Y-%m-%dT%H:%M:%S%z'
18
+ # time :start_date, format: '%Y-%m-%dT%H:%M:%S%z'
19
19
  #
20
20
  # @since 0.1.0
21
21
  #
@@ -39,12 +39,12 @@ module ActiveInteraction
39
39
  if Time.respond_to?(:zone) && !Time.zone.nil?
40
40
  Time.zone
41
41
  else
42
- Time
42
+ super
43
43
  end
44
44
  end
45
45
 
46
- def value_class
47
- klass.at(0).class
46
+ def klasses
47
+ [Time, klass.at(0).class]
48
48
  end
49
49
  end
50
50
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  # rubocop:disable Documentation
4
4
  module ActiveInteraction
5
- VERSION = Gem::Version.new('0.10.1')
5
+ VERSION = Gem::Version.new('0.10.2')
6
6
  end
@@ -9,7 +9,7 @@ describe ActiveInteraction::AbstractDateTimeFilter, :filter do
9
9
  let(:value) { nil }
10
10
 
11
11
  it 'raises an error' do
12
- expect { filter.cast(value) }.to raise_error NotImplementedError
12
+ expect { filter.cast(value) }.to raise_error NameError
13
13
  end
14
14
  end
15
15
  end
@@ -56,5 +56,21 @@ describe TimeInteraction do
56
56
  expect(result[:a]).to eq TimeZone.parse(a)
57
57
  end
58
58
  end
59
+
60
+ context 'with a Time' do
61
+ let(:a) { Time.now }
62
+
63
+ it 'returns the correct value' do
64
+ expect(result[:a]).to eq a
65
+ end
66
+ end
67
+
68
+ context 'with a TimeZone' do
69
+ let(:a) { TimeWithZone.new(Time.now) }
70
+
71
+ it 'returns the correct value' do
72
+ expect(result[:a]).to eq a
73
+ end
74
+ end
59
75
  end
60
76
  end
data/spec/spec_helper.rb CHANGED
@@ -5,7 +5,7 @@ Coveralls.wear!
5
5
 
6
6
  require 'active_interaction'
7
7
 
8
- Dir['./spec/support/**/*.rb'].sort.each { |f| require f }
8
+ Dir['./spec/support/**/*.rb'].each { |f| require f }
9
9
 
10
10
  RSpec.configure do |config|
11
11
  config.treat_symbols_as_metadata_keys_with_true_values = true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_interaction
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Lasseigne
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-20 00:00:00.000000000 Z
12
+ date: 2014-01-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel
@@ -37,14 +37,14 @@ dependencies:
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: '1.3'
40
+ version: '1.5'
41
41
  type: :development
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: '1.3'
47
+ version: '1.5'
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: coveralls
50
50
  requirement: !ruby/object:Gem::Requirement
@@ -107,14 +107,14 @@ dependencies:
107
107
  requirements:
108
108
  - - ~>
109
109
  - !ruby/object:Gem::Version
110
- version: '4.0'
110
+ version: '4.1'
111
111
  type: :development
112
112
  prerelease: false
113
113
  version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ~>
116
116
  - !ruby/object:Gem::Version
117
- version: '4.0'
117
+ version: '4.1'
118
118
  - !ruby/object:Gem::Dependency
119
119
  name: rspec
120
120
  requirement: !ruby/object:Gem::Requirement
@@ -135,14 +135,14 @@ dependencies:
135
135
  requirements:
136
136
  - - ~>
137
137
  - !ruby/object:Gem::Version
138
- version: '0.15'
138
+ version: '0.16'
139
139
  type: :development
140
140
  prerelease: false
141
141
  version_requirements: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - ~>
144
144
  - !ruby/object:Gem::Version
145
- version: '0.15'
145
+ version: '0.16'
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: yard
148
148
  requirement: !ruby/object:Gem::Requirement
@@ -165,9 +165,14 @@ executables: []
165
165
  extensions: []
166
166
  extra_rdoc_files: []
167
167
  files:
168
+ - CHANGELOG.md
169
+ - LICENSE.txt
170
+ - README.md
171
+ - lib/active_interaction.rb
168
172
  - lib/active_interaction/base.rb
169
173
  - lib/active_interaction/errors.rb
170
174
  - lib/active_interaction/filter.rb
175
+ - lib/active_interaction/filters.rb
171
176
  - lib/active_interaction/filters/abstract_date_time_filter.rb
172
177
  - lib/active_interaction/filters/abstract_numeric_filter.rb
173
178
  - lib/active_interaction/filters/array_filter.rb
@@ -182,14 +187,12 @@ files:
182
187
  - lib/active_interaction/filters/string_filter.rb
183
188
  - lib/active_interaction/filters/symbol_filter.rb
184
189
  - lib/active_interaction/filters/time_filter.rb
185
- - lib/active_interaction/filters.rb
186
190
  - lib/active_interaction/modules/active_model.rb
187
191
  - lib/active_interaction/modules/core.rb
188
192
  - lib/active_interaction/modules/method_missing.rb
189
193
  - lib/active_interaction/modules/overload_hash.rb
190
194
  - lib/active_interaction/modules/validation.rb
191
195
  - lib/active_interaction/version.rb
192
- - lib/active_interaction.rb
193
196
  - spec/active_interaction/base_spec.rb
194
197
  - spec/active_interaction/errors_spec.rb
195
198
  - spec/active_interaction/filter_spec.rb
@@ -229,9 +232,6 @@ files:
229
232
  - spec/spec_helper.rb
230
233
  - spec/support/filters.rb
231
234
  - spec/support/interactions.rb
232
- - CHANGELOG.md
233
- - LICENSE.txt
234
- - README.md
235
235
  homepage: http://orgsync.github.io/active_interaction/
236
236
  licenses:
237
237
  - MIT
@@ -252,7 +252,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
252
252
  version: '0'
253
253
  requirements: []
254
254
  rubyforge_project:
255
- rubygems_version: 2.1.11
255
+ rubygems_version: 2.2.0
256
256
  signing_key:
257
257
  specification_version: 4
258
258
  summary: Manage application specific business logic.