interactor-initializer 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/interactor/initializer.rb +12 -2
- data/lib/interactor/initializer/version.rb +1 -1
- data/spec/{initializer → interactor/initializer}/attr_readers_spec.rb +0 -0
- data/spec/{initializer → interactor/initializer}/initialize_spec.rb +0 -0
- data/spec/interactor/initializer_spec.rb +29 -0
- metadata +5 -6
- data/lib/interactor/initializer/call_methods.rb +0 -9
- data/spec/initializer/call_methods_spec.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5af4b74086ee54c325a0978227a41cba1449b7369ae4d77d8144cb93e4392a36
|
4
|
+
data.tar.gz: cc5551943cffcf530daf69fe18c29bee0fcb46a4c07cb411bb13074a5f74772d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7cf6987a066b3649813d0c38da664c6c6f49aac8541e34055c636e5f182c03c30a3d55987cce42b36c299bc8b49003e92a3a52780e9ea8dec45a7fb9fc2bc9b
|
7
|
+
data.tar.gz: 5ee5a3989601d9c70eec1245c1fab592ff78b45aa4a2efe614f5036382bbcf4986e692581dda139470f29ee1d205e8c5f9c29b8be46ea363fdaabed156b9c6f9
|
@@ -1,16 +1,26 @@
|
|
1
1
|
require 'interactor/initializer/version'
|
2
2
|
require 'interactor/initializer/attr_readers'
|
3
|
-
require 'interactor/initializer/call_methods'
|
4
3
|
require 'interactor/initializer/initialize'
|
5
4
|
|
6
5
|
module Interactor
|
7
6
|
module Initializer
|
8
7
|
def self.included(target_class)
|
9
8
|
target_class.extend ClassMethods
|
10
|
-
Interactor::Initializer::CallMethods.for(target_class)
|
11
9
|
end
|
12
10
|
|
13
11
|
module ClassMethods
|
12
|
+
def for(*args)
|
13
|
+
new(*args).run
|
14
|
+
end
|
15
|
+
|
16
|
+
def with(*args)
|
17
|
+
new(*args).run
|
18
|
+
end
|
19
|
+
|
20
|
+
def run(*args)
|
21
|
+
new(*args).run
|
22
|
+
end
|
23
|
+
|
14
24
|
module_function
|
15
25
|
|
16
26
|
def initialize_with(*attributes)
|
File without changes
|
File without changes
|
@@ -0,0 +1,29 @@
|
|
1
|
+
describe Interactor::Initializer do
|
2
|
+
let(:interactor) do
|
3
|
+
Class.new do
|
4
|
+
include Interactor::Initializer
|
5
|
+
|
6
|
+
def run
|
7
|
+
:result
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '.for' do
|
13
|
+
subject { interactor.for }
|
14
|
+
|
15
|
+
it { is_expected.to eq(:result) }
|
16
|
+
end
|
17
|
+
|
18
|
+
describe '.with' do
|
19
|
+
subject { interactor.with }
|
20
|
+
|
21
|
+
it { is_expected.to eq(:result) }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '.run' do
|
25
|
+
subject { interactor.run }
|
26
|
+
|
27
|
+
it { is_expected.to eq(:result) }
|
28
|
+
end
|
29
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: interactor-initializer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Šarūnas Kūjalis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -70,12 +70,11 @@ files:
|
|
70
70
|
- interactor-initializer.gemspec
|
71
71
|
- lib/interactor/initializer.rb
|
72
72
|
- lib/interactor/initializer/attr_readers.rb
|
73
|
-
- lib/interactor/initializer/call_methods.rb
|
74
73
|
- lib/interactor/initializer/initialize.rb
|
75
74
|
- lib/interactor/initializer/version.rb
|
76
|
-
- spec/initializer/attr_readers_spec.rb
|
77
|
-
- spec/initializer/
|
78
|
-
- spec/
|
75
|
+
- spec/interactor/initializer/attr_readers_spec.rb
|
76
|
+
- spec/interactor/initializer/initialize_spec.rb
|
77
|
+
- spec/interactor/initializer_spec.rb
|
79
78
|
- spec/spec_helper.rb
|
80
79
|
homepage: https://github.com/vinted/interactor-initializer
|
81
80
|
licenses:
|
@@ -1,13 +0,0 @@
|
|
1
|
-
describe Interactor::Initializer::CallMethods do
|
2
|
-
describe '.for' do
|
3
|
-
subject { described_class.for(dummy_class) }
|
4
|
-
let(:dummy_class) { Class.new }
|
5
|
-
|
6
|
-
it 'adds .for .with and .run class methods' do
|
7
|
-
subject
|
8
|
-
expect(dummy_class).to respond_to :for
|
9
|
-
expect(dummy_class).to respond_to :with
|
10
|
-
expect(dummy_class).to respond_to :run
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|