rohbau 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/lib/rohbau/interface.rb +11 -5
- data/lib/rohbau/version.rb +1 -1
- data/rohbau.gemspec +1 -1
- data/spec/interface_spec.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6649cf14d7ab87b32c3daef3312ad0787da2094
|
4
|
+
data.tar.gz: d561748d16c16e5d7ca7f8bb5ae64a3e7ef417c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1048283aeb2498a565acbaeb1986fa3db1a64b48cc905a522c3a4fbfcaf274ed8501967534952e25feca85d445602cccd1776ea63228f7a748b82c2e2a119ad4
|
7
|
+
data.tar.gz: 51f0098a5a8e6f5ba47da651c12e2e0c67079bb573d2f8dd4d4c5e845dd5b1784fd824aca1f0b67866df44297a81f11b1d2590d7731a9991a203532f76ed4077
|
data/.rubocop.yml
CHANGED
data/lib/rohbau/interface.rb
CHANGED
@@ -73,15 +73,11 @@ module Rohbau
|
|
73
73
|
use_case = args[0]
|
74
74
|
input = args[1] || {}
|
75
75
|
call_use_case(domain, use_case, input)
|
76
|
-
rescue NameError => e
|
77
|
-
msg = "You tried to call a use case from the #{domain} domain, " \
|
78
|
-
"but the following error occured: #{e.inspect}"
|
79
|
-
raise msg
|
80
76
|
end
|
81
77
|
|
82
78
|
class Caller
|
83
79
|
def initialize(domain)
|
84
|
-
@domain = domain
|
80
|
+
@domain = validate_and_return!(domain)
|
85
81
|
end
|
86
82
|
|
87
83
|
def call(use_case, args, options = {})
|
@@ -122,6 +118,16 @@ module Rohbau
|
|
122
118
|
end
|
123
119
|
end
|
124
120
|
|
121
|
+
def validate_and_return!(domain)
|
122
|
+
return domain if Object.const_defined?(domain)
|
123
|
+
raise ArgumentError, missing_domain_message(domain)
|
124
|
+
end
|
125
|
+
|
126
|
+
def missing_domain_message(domain)
|
127
|
+
"You tried to call a use case from the #{domain}, but that domain " \
|
128
|
+
"does not exist."
|
129
|
+
end
|
130
|
+
|
125
131
|
def domain
|
126
132
|
@domain
|
127
133
|
end
|
data/lib/rohbau/version.rb
CHANGED
data/rohbau.gemspec
CHANGED
data/spec/interface_spec.rb
CHANGED
metadata
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rohbau
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jakob Holderbaum
|
8
8
|
- Peter Suschlik
|
9
|
-
- Dax
|
9
|
+
- Dax
|
10
10
|
- Andreas Busold
|
11
11
|
- Jan Owiesniak
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2015-
|
15
|
+
date: 2015-05-19 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: thread_safe
|
@@ -188,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
188
188
|
version: '0'
|
189
189
|
requirements: []
|
190
190
|
rubyforge_project:
|
191
|
-
rubygems_version: 2.
|
191
|
+
rubygems_version: 2.4.6
|
192
192
|
signing_key:
|
193
193
|
specification_version: 4
|
194
194
|
summary: Provides a set of patterns used in Domain Driven Design
|