servactory 3.0.2 → 3.0.3
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/servactory/configuration/config.rb +16 -0
- data/lib/servactory/configuration/configurable.rb +6 -3
- data/lib/servactory/configuration/hash_mode/class_names_collection.rb +4 -1
- data/lib/servactory/configuration/option_helpers/option_helpers_collection.rb +9 -0
- data/lib/servactory/tool_kit/dynamic_options/consists_of.rb +4 -2
- data/lib/servactory/tool_kit/dynamic_options/schema.rb +4 -2
- data/lib/servactory/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5a6c62222fdb6c8296ad18090175dbae796eabb8758f382f1e5db6c24a2f6404
|
|
4
|
+
data.tar.gz: e01dc48bcb0153aab16235d955f1c569490fcc58c10b3c6ff56a29b7c1165dd5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 485c0b027a317d904d3bc0e70f93de122ec7c5009bcf9f41995a0156d09b0077b48f6b735cdf8f50918d42605664b960ee92cf008284c43620018fd21bcaf752
|
|
7
|
+
data.tar.gz: 4706a650d908ea150c46a19c83f784211ed517e5d0bba5f63999006f29e70768ab9c7bb082f6de0301afa669035cb929e7f31f64a53be50ce8305ddd044b3b9e
|
|
@@ -30,6 +30,22 @@ module Servactory
|
|
|
30
30
|
@collection_mode_class_names = original.collection_mode_class_names.dup
|
|
31
31
|
@hash_mode_class_names = original.hash_mode_class_names.dup
|
|
32
32
|
@action_rescue_handlers = original.action_rescue_handlers.dup
|
|
33
|
+
|
|
34
|
+
rebind_dynamic_option_helpers!
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
private
|
|
38
|
+
|
|
39
|
+
def rebind_dynamic_option_helpers!
|
|
40
|
+
new_consists_of = Servactory::ToolKit::DynamicOptions::ConsistsOf
|
|
41
|
+
.use(collection_mode_class_names: @collection_mode_class_names)
|
|
42
|
+
new_schema = Servactory::ToolKit::DynamicOptions::Schema
|
|
43
|
+
.use(default_hash_mode_class_names: @hash_mode_class_names)
|
|
44
|
+
|
|
45
|
+
[@input_option_helpers, @internal_option_helpers, @output_option_helpers].each do |helpers|
|
|
46
|
+
helpers.replace(name: :consists_of, with: new_consists_of)
|
|
47
|
+
helpers.replace(name: :schema, with: new_schema)
|
|
48
|
+
end
|
|
33
49
|
end
|
|
34
50
|
end
|
|
35
51
|
end
|
|
@@ -67,7 +67,8 @@ module Servactory
|
|
|
67
67
|
.new(name: :optional, equivalent: { required: false }),
|
|
68
68
|
Servactory::ToolKit::DynamicOptions::ConsistsOf
|
|
69
69
|
.use(collection_mode_class_names: config.collection_mode_class_names),
|
|
70
|
-
Servactory::ToolKit::DynamicOptions::Schema
|
|
70
|
+
Servactory::ToolKit::DynamicOptions::Schema
|
|
71
|
+
.use(default_hash_mode_class_names: config.hash_mode_class_names),
|
|
71
72
|
Servactory::ToolKit::DynamicOptions::Inclusion.use
|
|
72
73
|
]
|
|
73
74
|
end
|
|
@@ -76,7 +77,8 @@ module Servactory
|
|
|
76
77
|
Set[
|
|
77
78
|
Servactory::ToolKit::DynamicOptions::ConsistsOf
|
|
78
79
|
.use(collection_mode_class_names: config.collection_mode_class_names),
|
|
79
|
-
Servactory::ToolKit::DynamicOptions::Schema
|
|
80
|
+
Servactory::ToolKit::DynamicOptions::Schema
|
|
81
|
+
.use(default_hash_mode_class_names: config.hash_mode_class_names),
|
|
80
82
|
Servactory::ToolKit::DynamicOptions::Inclusion.use
|
|
81
83
|
]
|
|
82
84
|
end
|
|
@@ -85,7 +87,8 @@ module Servactory
|
|
|
85
87
|
Set[
|
|
86
88
|
Servactory::ToolKit::DynamicOptions::ConsistsOf
|
|
87
89
|
.use(collection_mode_class_names: config.collection_mode_class_names),
|
|
88
|
-
Servactory::ToolKit::DynamicOptions::Schema
|
|
90
|
+
Servactory::ToolKit::DynamicOptions::Schema
|
|
91
|
+
.use(default_hash_mode_class_names: config.hash_mode_class_names),
|
|
89
92
|
Servactory::ToolKit::DynamicOptions::Inclusion.use
|
|
90
93
|
]
|
|
91
94
|
end
|
|
@@ -24,6 +24,15 @@ module Servactory
|
|
|
24
24
|
def find_by(name:)
|
|
25
25
|
find { |helper| helper.name == name }
|
|
26
26
|
end
|
|
27
|
+
|
|
28
|
+
def replace(name:, with:)
|
|
29
|
+
# TODO: Add index-based lookup in version 3.1.
|
|
30
|
+
old = find { |helper| helper.name == name }
|
|
31
|
+
return unless old
|
|
32
|
+
|
|
33
|
+
@collection.delete(old)
|
|
34
|
+
@collection.add(with)
|
|
35
|
+
end
|
|
27
36
|
end
|
|
28
37
|
end
|
|
29
38
|
end
|
|
@@ -88,7 +88,8 @@ module Servactory
|
|
|
88
88
|
# Creates a ConsistsOf validator instance.
|
|
89
89
|
#
|
|
90
90
|
# @param option_name [Symbol] The option name (default: :consists_of)
|
|
91
|
-
# @param collection_mode_class_names [
|
|
91
|
+
# @param collection_mode_class_names [Servactory::Configuration::CollectionMode::ClassNamesCollection]
|
|
92
|
+
# Valid collection types
|
|
92
93
|
# @return [Servactory::Maintenance::Attributes::OptionHelper]
|
|
93
94
|
def self.use(option_name = :consists_of, collection_mode_class_names:)
|
|
94
95
|
instance = new(option_name, :type, false)
|
|
@@ -98,7 +99,8 @@ module Servactory
|
|
|
98
99
|
|
|
99
100
|
# Assigns the list of valid collection class names.
|
|
100
101
|
#
|
|
101
|
-
# @param collection_mode_class_names [
|
|
102
|
+
# @param collection_mode_class_names [Servactory::Configuration::CollectionMode::ClassNamesCollection]
|
|
103
|
+
# Collection types to accept
|
|
102
104
|
# @return [void]
|
|
103
105
|
def assign(collection_mode_class_names)
|
|
104
106
|
@collection_mode_class_names = collection_mode_class_names
|
|
@@ -127,7 +127,8 @@ module Servactory
|
|
|
127
127
|
# Creates a Schema validator instance.
|
|
128
128
|
#
|
|
129
129
|
# @param option_name [Symbol] The option name (default: :schema)
|
|
130
|
-
# @param default_hash_mode_class_names [
|
|
130
|
+
# @param default_hash_mode_class_names [Servactory::Configuration::HashMode::ClassNamesCollection]
|
|
131
|
+
# Valid Hash-like types
|
|
131
132
|
# @return [Servactory::Maintenance::Attributes::OptionHelper]
|
|
132
133
|
def self.use(option_name = :schema, default_hash_mode_class_names:)
|
|
133
134
|
instance = new(option_name, :is, false)
|
|
@@ -137,7 +138,8 @@ module Servactory
|
|
|
137
138
|
|
|
138
139
|
# Assigns the list of valid Hash-compatible class names.
|
|
139
140
|
#
|
|
140
|
-
# @param default_hash_mode_class_names [
|
|
141
|
+
# @param default_hash_mode_class_names [Servactory::Configuration::HashMode::ClassNamesCollection]
|
|
142
|
+
# Hash-like types to accept
|
|
141
143
|
# @return [void]
|
|
142
144
|
def assign(default_hash_mode_class_names)
|
|
143
145
|
@default_hash_mode_class_names = default_hash_mode_class_names
|
data/lib/servactory/version.rb
CHANGED