active_interaction 1.3.0 → 1.3.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -1
- data/README.md +9 -9
- data/lib/active_interaction.rb +3 -3
- data/lib/active_interaction/concerns/missable.rb +1 -1
- data/lib/active_interaction/filter.rb +9 -2
- data/lib/active_interaction/filters/array_filter.rb +2 -2
- data/lib/active_interaction/version.rb +1 -1
- data/spec/active_interaction/filters/array_filter_spec.rb +18 -0
- data/spec/active_interaction/filters/interface_filter_spec.rb +8 -0
- data/spec/active_interaction/filters/time_filter_spec.rb +3 -1
- metadata +27 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17c5f3f9d7839f69402b77687939e96072fb1d90
|
4
|
+
data.tar.gz: 825810914132a17a96ba6aabee8df1f9c86f5dc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e53ecbca6b68702b4fec258879193e776d82cc8d38ff55c9e8c0296ec8858a2d934a782f5f6ac89cbe21c07ad1e93315dd8069d51011e7da0afcc22151fd6f2f
|
7
|
+
data.tar.gz: b36c35ef30dad6c6d1c63af024a50c18b4a5ef474158a29a4c6cb7984338ae65e429ad968bffcc427bc608d27cde23b06802c55fb9ab57e38ca4999a051336a2
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# [Master][]
|
2
2
|
|
3
|
+
# [1.3.1][] (2014-12-10)
|
4
|
+
|
5
|
+
## Fixed
|
6
|
+
|
7
|
+
- [#235][]: Fix a bug that prevented custom translations from loading.
|
8
|
+
- [#224][]: Fix a bug that incorrectly inferred plural class names for filters
|
9
|
+
inside arrays.
|
10
|
+
|
3
11
|
# [1.3.0][] (2014-08-15)
|
4
12
|
|
5
13
|
## Added
|
@@ -346,7 +354,8 @@
|
|
346
354
|
|
347
355
|
- Initial release.
|
348
356
|
|
349
|
-
[master]: https://github.com/orgsync/active_interaction/compare/v1.3.
|
357
|
+
[master]: https://github.com/orgsync/active_interaction/compare/v1.3.1...master
|
358
|
+
[1.3.1]: https://github.com/orgsync/active_interaction/compare/v1.3.0...v1.3.1
|
350
359
|
[1.3.0]: https://github.com/orgsync/active_interaction/compare/v1.2.5...v1.3.0
|
351
360
|
[1.2.5]: https://github.com/orgsync/active_interaction/compare/v1.2.4...v1.2.5
|
352
361
|
[1.2.4]: https://github.com/orgsync/active_interaction/compare/v1.2.3...v1.2.4
|
@@ -455,3 +464,5 @@
|
|
455
464
|
[#203]: https://github.com/orgsync/active_interaction/issues/203
|
456
465
|
[#206]: https://github.com/orgsync/active_interaction/issues/206
|
457
466
|
[#207]: https://github.com/orgsync/active_interaction/issues/207
|
467
|
+
[#224]: https://github.com/orgsync/active_interaction/issues/224
|
468
|
+
[#235]: https://github.com/orgsync/active_interaction/issues/235
|
data/README.md
CHANGED
@@ -24,19 +24,19 @@ This project uses [semantic versioning][13].
|
|
24
24
|
|
25
25
|
Add it to your Gemfile:
|
26
26
|
|
27
|
-
```ruby
|
27
|
+
``` ruby
|
28
28
|
gem 'active_interaction', '~> 1.3'
|
29
29
|
```
|
30
30
|
|
31
31
|
And then execute:
|
32
32
|
|
33
|
-
```sh
|
33
|
+
``` sh
|
34
34
|
$ bundle
|
35
35
|
```
|
36
36
|
|
37
37
|
Or install it yourself with:
|
38
38
|
|
39
|
-
```sh
|
39
|
+
``` sh
|
40
40
|
$ gem install active_interaction
|
41
41
|
```
|
42
42
|
|
@@ -238,7 +238,7 @@ into `config/locales`. So, for example, let's say that (for whatever
|
|
238
238
|
reason) you want to print out everything backwards. Simply add
|
239
239
|
translations for ActiveInteraction to your `hsilgne` locale:
|
240
240
|
|
241
|
-
```
|
241
|
+
```ruby
|
242
242
|
# config/locales/hsilgne.yml
|
243
243
|
hsilgne:
|
244
244
|
active_interaction:
|
@@ -281,15 +281,15 @@ ActiveInteraction is brought to you by [@AaronLasseigne][14] and
|
|
281
281
|
work done in [Mutations][17].
|
282
282
|
|
283
283
|
[0]: https://github.com/orgsync/active_interaction
|
284
|
-
[1]: https://
|
284
|
+
[1]: https://img.shields.io/gem/v/active_interaction.svg?style=flat
|
285
285
|
[2]: http://rubygems.org/gems/active_interaction "Gem Version"
|
286
|
-
[3]: https://
|
286
|
+
[3]: https://img.shields.io/travis/orgsync/active_interaction/master.svg?style=flat
|
287
287
|
[4]: https://travis-ci.org/orgsync/active_interaction "Build Status"
|
288
|
-
[5]: https://img.shields.io/coveralls/orgsync/active_interaction/master.svg
|
288
|
+
[5]: https://img.shields.io/coveralls/orgsync/active_interaction/master.svg?style=flat
|
289
289
|
[6]: https://coveralls.io/r/orgsync/active_interaction?branch=master "Coverage Status"
|
290
|
-
[7]: https://
|
290
|
+
[7]: https://img.shields.io/codeclimate/github/orgsync/active_interaction.svg?style=flat
|
291
291
|
[8]: https://codeclimate.com/github/orgsync/active_interaction "Code Climate"
|
292
|
-
[9]: https://
|
292
|
+
[9]: https://img.shields.io/gemnasium/orgsync/active_interaction.svg?style=flat
|
293
293
|
[10]: https://gemnasium.com/orgsync/active_interaction "Dependency Status"
|
294
294
|
[11]: http://orgsync.github.io/active_interaction/
|
295
295
|
[12]: http://rubydoc.info/github/orgsync/active_interaction
|
data/lib/active_interaction.rb
CHANGED
@@ -40,8 +40,8 @@ require 'active_interaction/base'
|
|
40
40
|
|
41
41
|
require 'active_interaction/backports'
|
42
42
|
|
43
|
-
I18n.load_path
|
44
|
-
File.join(%w[active_interaction locale *.yml]), File.dirname(__FILE__))]
|
43
|
+
I18n.load_path.unshift(Dir[File.expand_path(
|
44
|
+
File.join(%w[active_interaction locale *.yml]), File.dirname(__FILE__))])
|
45
45
|
|
46
46
|
# Manage application specific business logic.
|
47
47
|
#
|
@@ -50,5 +50,5 @@ I18n.load_path += Dir[File.expand_path(
|
|
50
50
|
#
|
51
51
|
# @since 1.0.0
|
52
52
|
#
|
53
|
-
# @version 1.3.
|
53
|
+
# @version 1.3.1
|
54
54
|
module ActiveInteraction end
|
@@ -16,7 +16,7 @@ module ActiveInteraction
|
|
16
16
|
# @yieldparam options [Hash]
|
17
17
|
#
|
18
18
|
# @return [Missable]
|
19
|
-
def method_missing(slug, *args
|
19
|
+
def method_missing(slug, *args)
|
20
20
|
return super unless (klass = filter(slug))
|
21
21
|
|
22
22
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
@@ -54,7 +54,6 @@ module ActiveInteraction
|
|
54
54
|
private
|
55
55
|
|
56
56
|
# @param slug [Symbol]
|
57
|
-
# @param klass [Class]
|
58
57
|
#
|
59
58
|
# @return [Class]
|
60
59
|
def register(slug)
|
@@ -173,7 +172,7 @@ module ActiveInteraction
|
|
173
172
|
|
174
173
|
nil
|
175
174
|
else
|
176
|
-
fail InvalidValueError, "#{name}: #{value
|
175
|
+
fail InvalidValueError, "#{name}: #{describe(value)}"
|
177
176
|
end
|
178
177
|
end
|
179
178
|
|
@@ -196,6 +195,14 @@ module ActiveInteraction
|
|
196
195
|
|
197
196
|
private
|
198
197
|
|
198
|
+
# @param value [Object]
|
199
|
+
# @return [String]
|
200
|
+
def describe(value)
|
201
|
+
value.inspect
|
202
|
+
rescue NoMethodError
|
203
|
+
"(Object doesn't support #inspect)"
|
204
|
+
end
|
205
|
+
|
199
206
|
# @return [Object]
|
200
207
|
def raw_default
|
201
208
|
value = options.fetch(:default)
|
@@ -41,11 +41,11 @@ module ActiveInteraction
|
|
41
41
|
|
42
42
|
def method_missing(*, &block)
|
43
43
|
super do |klass, names, options|
|
44
|
-
filter = klass.new(name, options, &block)
|
44
|
+
filter = klass.new(name.to_s.singularize.to_sym, options, &block)
|
45
45
|
|
46
46
|
validate(filter, names)
|
47
47
|
|
48
|
-
filters[name] = filter
|
48
|
+
filters[filter.name] = filter
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -83,6 +83,24 @@ describe ActiveInteraction::ArrayFilter, :filter do
|
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|
86
|
+
|
87
|
+
context 'with a nested model filter' do
|
88
|
+
let(:block) { proc { model } }
|
89
|
+
let(:name) { :objects }
|
90
|
+
let(:value) { [Object.new] }
|
91
|
+
|
92
|
+
it 'does not raise an error' do
|
93
|
+
expect { result }.to_not raise_error
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'has a filter with the right key' do
|
97
|
+
expect(filter.filters).to have_key(:object)
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'has a filter with the right name' do
|
101
|
+
expect(filter.filters[:object].name).to eql(:object)
|
102
|
+
end
|
103
|
+
end
|
86
104
|
end
|
87
105
|
|
88
106
|
describe '#database_column_type' do
|
@@ -13,6 +13,14 @@ describe ActiveInteraction::InterfaceFilter, :filter do
|
|
13
13
|
describe '#cast' do
|
14
14
|
let(:result) { filter.cast(value) }
|
15
15
|
|
16
|
+
context 'with a BasicObject' do
|
17
|
+
let(:value) { BasicObject.new }
|
18
|
+
|
19
|
+
it 'raises an error' do
|
20
|
+
expect { result }.to raise_error ActiveInteraction::InvalidValueError
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
16
24
|
context 'with an Object' do
|
17
25
|
let(:value) { Object.new }
|
18
26
|
|
@@ -28,7 +28,9 @@ describe ActiveInteraction::TimeFilter, :filter do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'raises an error' do
|
31
|
-
expect
|
31
|
+
expect do
|
32
|
+
filter
|
33
|
+
end.to raise_error(ActiveInteraction::InvalidFilterError)
|
32
34
|
end
|
33
35
|
end
|
34
36
|
end
|
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: 1.3.
|
4
|
+
version: 1.3.1
|
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: 2014-
|
12
|
+
date: 2014-12-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|
@@ -88,75 +88,75 @@ dependencies:
|
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '1.1'
|
90
90
|
- !ruby/object:Gem::Dependency
|
91
|
-
name:
|
91
|
+
name: kramdown
|
92
92
|
requirement: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - ~>
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '1.5'
|
97
97
|
type: :development
|
98
98
|
prerelease: false
|
99
99
|
version_requirements: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ~>
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '1.5'
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
|
-
name:
|
105
|
+
name: rake
|
106
106
|
requirement: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - ~>
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '10.3'
|
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: '
|
117
|
+
version: '10.3'
|
118
118
|
- !ruby/object:Gem::Dependency
|
119
|
-
name:
|
119
|
+
name: rspec
|
120
120
|
requirement: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ~>
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: '3.1'
|
125
125
|
type: :development
|
126
126
|
prerelease: false
|
127
127
|
version_requirements: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ~>
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: '3.1'
|
132
132
|
- !ruby/object:Gem::Dependency
|
133
|
-
name:
|
133
|
+
name: rubocop
|
134
134
|
requirement: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - ~>
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '0.
|
138
|
+
version: '0.28'
|
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.
|
145
|
+
version: '0.28'
|
146
146
|
- !ruby/object:Gem::Dependency
|
147
|
-
name:
|
147
|
+
name: yard
|
148
148
|
requirement: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - ~>
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
152
|
+
version: '0.8'
|
153
153
|
type: :development
|
154
154
|
prerelease: false
|
155
155
|
version_requirements: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- -
|
157
|
+
- - ~>
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
159
|
+
version: '0.8'
|
160
160
|
description: Manage application specific business logic.
|
161
161
|
email:
|
162
162
|
- aaron.lasseigne@gmail.com
|
@@ -165,6 +165,10 @@ 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/backports.rb
|
169
173
|
- lib/active_interaction/base.rb
|
170
174
|
- lib/active_interaction/concerns/active_modelable.rb
|
@@ -193,10 +197,10 @@ files:
|
|
193
197
|
- lib/active_interaction/filters/symbol_filter.rb
|
194
198
|
- lib/active_interaction/filters/time_filter.rb
|
195
199
|
- lib/active_interaction/grouped_input.rb
|
200
|
+
- lib/active_interaction/locale/en.yml
|
196
201
|
- lib/active_interaction/modules/input_processor.rb
|
197
202
|
- lib/active_interaction/modules/validation.rb
|
198
203
|
- lib/active_interaction/version.rb
|
199
|
-
- lib/active_interaction.rb
|
200
204
|
- spec/active_interaction/base_spec.rb
|
201
205
|
- spec/active_interaction/concerns/active_modelable_spec.rb
|
202
206
|
- spec/active_interaction/concerns/hashable_spec.rb
|
@@ -244,10 +248,6 @@ files:
|
|
244
248
|
- spec/support/concerns.rb
|
245
249
|
- spec/support/filters.rb
|
246
250
|
- spec/support/interactions.rb
|
247
|
-
- CHANGELOG.md
|
248
|
-
- LICENSE.txt
|
249
|
-
- README.md
|
250
|
-
- lib/active_interaction/locale/en.yml
|
251
251
|
homepage: http://orgsync.github.io/active_interaction/
|
252
252
|
licenses:
|
253
253
|
- MIT
|
@@ -268,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
268
268
|
version: '0'
|
269
269
|
requirements: []
|
270
270
|
rubyforge_project:
|
271
|
-
rubygems_version: 2.
|
271
|
+
rubygems_version: 2.4.4
|
272
272
|
signing_key:
|
273
273
|
specification_version: 4
|
274
274
|
summary: Manage application specific business logic.
|