ddd_domain 1.5.9 → 1.5.11
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/lib/ddd_domain/domain_result.rb +22 -0
- data/lib/ddd_domain/version.rb +1 -1
- data/lib/generators/domains/domains_generator.rb +7 -0
- metadata +7 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c4932c51469814024e97cfc99a56eed8058c28350b2e0b28971c5cfff0d144c1
|
|
4
|
+
data.tar.gz: '0768c882385171258ea8e70f5b8895afe642904643b05e7792034178314a5f3b'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1648269e8870d6dd8eb0bd8f89907abd97238eaef531040116142a0b0c10ec6098bacfe905852cf29ddd8ff20b20c7999980e20a224543d16a9e4d609b9f0069
|
|
7
|
+
data.tar.gz: 701918fc4e895b43ed5539b2f55e4b156d3d5ce8ac509fe77f9da88b46080921b4d7e738aaf5895eec1eba720d6782bff2ef0caa61e05ffd18f34b642895bd81
|
|
@@ -10,6 +10,11 @@ module DddDomain
|
|
|
10
10
|
# - exception: the original exception behind an unexpected failure (for
|
|
11
11
|
# logging and diagnostics; do not branch business logic on it)
|
|
12
12
|
#
|
|
13
|
+
# The exception is never exposed by #to_h (and therefore by #as_json /
|
|
14
|
+
# #to_json under ActiveSupport), and #inspect shows only its class, so that
|
|
15
|
+
# internal error details do not leak into responses or logs by accident.
|
|
16
|
+
# Read #exception explicitly when you need it.
|
|
17
|
+
#
|
|
13
18
|
# @example
|
|
14
19
|
# result = DddDomain::DomainResult.failure("The order is already shipped")
|
|
15
20
|
# result.failure? # => true
|
|
@@ -36,5 +41,22 @@ module DddDomain
|
|
|
36
41
|
def failure?
|
|
37
42
|
!success
|
|
38
43
|
end
|
|
44
|
+
|
|
45
|
+
# @return [Hash] the attributes except +exception+
|
|
46
|
+
def to_h(&block)
|
|
47
|
+
hash = { success: success, message: message }
|
|
48
|
+
block ? hash.to_h(&block) : hash
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# @return [String] a representation that shows only the class of +exception+
|
|
52
|
+
def inspect
|
|
53
|
+
exception_text = exception.nil? ? "nil" : "#<#{exception.class}>"
|
|
54
|
+
"#<data #{self.class} success=#{success.inspect}, message=#{message.inspect}, exception=#{exception_text}>"
|
|
55
|
+
end
|
|
56
|
+
alias_method :to_s, :inspect
|
|
57
|
+
|
|
58
|
+
def pretty_print(q)
|
|
59
|
+
q.text(inspect)
|
|
60
|
+
end
|
|
39
61
|
end
|
|
40
62
|
end
|
data/lib/ddd_domain/version.rb
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
class DomainsGenerator < Rails::Generators::NamedBase
|
|
2
2
|
source_root File.expand_path('../templates', __FILE__)
|
|
3
3
|
|
|
4
|
+
VALID_NAME = /\A[a-z][a-z0-9_]*\z/
|
|
5
|
+
|
|
4
6
|
def create_initializer_file
|
|
7
|
+
unless file_name.match?(VALID_NAME)
|
|
8
|
+
raise Thor::Error, "Invalid domain name: #{name.inspect}. " \
|
|
9
|
+
"Use letters, digits and underscores, starting with a letter (e.g. order, user_account)."
|
|
10
|
+
end
|
|
11
|
+
|
|
5
12
|
empty_directory "app/domains/#{file_name}"
|
|
6
13
|
create_file "app/domains/#{file_name}/.keep"
|
|
7
14
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ddd_domain
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.5.
|
|
4
|
+
version: 1.5.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- FUNABARA Masao
|
|
@@ -44,7 +44,11 @@ files:
|
|
|
44
44
|
homepage: https://github.com/masoo/ddd_domain
|
|
45
45
|
licenses:
|
|
46
46
|
- MIT
|
|
47
|
-
metadata:
|
|
47
|
+
metadata:
|
|
48
|
+
homepage_uri: https://github.com/masoo/ddd_domain
|
|
49
|
+
source_code_uri: https://github.com/masoo/ddd_domain
|
|
50
|
+
bug_tracker_uri: https://github.com/masoo/ddd_domain/issues
|
|
51
|
+
rubygems_mfa_required: 'true'
|
|
48
52
|
rdoc_options: []
|
|
49
53
|
require_paths:
|
|
50
54
|
- lib
|
|
@@ -59,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
59
63
|
- !ruby/object:Gem::Version
|
|
60
64
|
version: '0'
|
|
61
65
|
requirements: []
|
|
62
|
-
rubygems_version: 4.0.
|
|
66
|
+
rubygems_version: 4.0.20
|
|
63
67
|
specification_version: 4
|
|
64
68
|
summary: It supports the domain of Domain Driven Design.
|
|
65
69
|
test_files: []
|