- Common =
Utils::Kwargs::Builder.build do
key :stage
key :scope, normalizer: ->(value) {
raise ArgumentError, 'scope 选项不可传递 nil' if value.nil?
value = [value] unless value.is_a?(Array)
value.map do |v|
next v if v.is_a?(Meta::Scope::Base)
scope_name = v.to_s.split('_').map(&:capitalize).join
if !defined?(::Scopes) || !::Scopes.const_defined?(scope_name)
raise NameError, "未找到常量 Scopes::#{scope_name}。如果你用的是命名 Scope(字符串或符号),则检查一下是不是拼写错误"
end
::Scopes.const_get(scope_name)
end.compact
}
handle_extras :merged
end
- ToDoc =
Utils::Kwargs::Builder.build(Common) do
key :schema_docs_mapping, :defined_scopes_mapping
end
- Filter =
Utils::Kwargs::Builder.build(Common) do
key :discard_missing, :exclude, :extra_properties, :type_conversion, :validation
key :execution, :user_data, :object_value
end