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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aba07a5627f76c6095247bcbfbd5ef8f4cc3e221
4
- data.tar.gz: 79c36065afca542bc02b79a77eca590e4b9bdde4
3
+ metadata.gz: a6649cf14d7ab87b32c3daef3312ad0787da2094
4
+ data.tar.gz: d561748d16c16e5d7ca7f8bb5ae64a3e7ef417c6
5
5
  SHA512:
6
- metadata.gz: f3951dabbee7a5af8d4e279935b33bed6475ec31a4b90ed8446ad03b6b89c93496ddcc26f6c1feaf849aee1316bf8ef0b9b6eda065a071e40bf6e34347459ed7
7
- data.tar.gz: 54b582e38ce22964cdc44b87f0b3a2f2aa776bd6241b0bd74f5dcbe7180970635c8cbff8b72ed15256ff9197f9d4f12391790567e6a4ffeca0171c95d14b456c
6
+ metadata.gz: 1048283aeb2498a565acbaeb1986fa3db1a64b48cc905a522c3a4fbfcaf274ed8501967534952e25feca85d445602cccd1776ea63228f7a748b82c2e2a119ad4
7
+ data.tar.gz: 51f0098a5a8e6f5ba47da651c12e2e0c67079bb573d2f8dd4d4c5e845dd5b1784fd824aca1f0b67866df44297a81f11b1d2590d7731a9991a203532f76ed4077
@@ -6,6 +6,10 @@ Metrics/LineLength:
6
6
  - rohbau.gemspec
7
7
  - examples/**/*.rb
8
8
 
9
+ Metrics/ModuleLength:
10
+ Exclude:
11
+ - lib/rohbau/shared_specs/default_gateway.rb
12
+
9
13
  Style/AlignParameters:
10
14
  EnforcedStyle: with_fixed_indentation
11
15
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Rohbau
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = [
10
10
  "Jakob Holderbaum",
11
11
  "Peter Suschlik",
12
- "Dax Defranco",
12
+ "Dax",
13
13
  "Andreas Busold",
14
14
  "Jan Owiesniak"
15
15
  ]
@@ -35,7 +35,7 @@ describe Rohbau::Interface do
35
35
  end
36
36
 
37
37
  it 'raises if the domain is unknown' do
38
- assert_raises RuntimeError do
38
+ assert_raises ArgumentError do
39
39
  interface.really_fake_domain :equally_fake_use_case
40
40
  end
41
41
  end
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.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakob Holderbaum
8
8
  - Peter Suschlik
9
- - Dax Defranco
9
+ - Dax
10
10
  - Andreas Busold
11
11
  - Jan Owiesniak
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2015-04-22 00:00:00.000000000 Z
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.1.11
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