From 7a2270cc5d34f002aaeb6debc052ed39fd604f59 Mon Sep 17 00:00:00 2001 From: Anton Date: Fri, 31 Jul 2020 13:53:00 +0300 Subject: [PATCH] Update dry-types >= 1.4 --- apiblueprint.gemspec | 2 +- lib/api-blueprint/blueprint.rb | 12 ++++++------ lib/api-blueprint/builder.rb | 6 +++--- lib/api-blueprint/struct.rb | 2 +- lib/api-blueprint/types.rb | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/apiblueprint.gemspec b/apiblueprint.gemspec index d2ad32c..a7fd9c3 100644 --- a/apiblueprint.gemspec +++ b/apiblueprint.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |s| s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] - s.add_dependency "dry-types" + s.add_dependency "dry-types", ">= 1.4" s.add_dependency "dry-struct" s.add_dependency "dry-initializer" s.add_dependency "dry-configurable" diff --git a/lib/api-blueprint/blueprint.rb b/lib/api-blueprint/blueprint.rb index 924796d..bd13842 100644 --- a/lib/api-blueprint/blueprint.rb +++ b/lib/api-blueprint/blueprint.rb @@ -2,14 +2,14 @@ module ApiBlueprint class Blueprint < ApiBlueprint::Struct attribute :http_method, Types::Symbol.default(:get).enum(*Faraday::Connection::METHODS) attribute :url, Types::String - attribute :headers, Types::Hash.default(Hash.new) - attribute :params, Types::Hash.default(Hash.new) - attribute :body, Types::Hash.default(Hash.new) + attribute :headers, Types::Hash.default { Hash.new } + attribute :params, Types::Hash.default { Hash.new } + attribute :body, Types::Hash.default { Hash.new } attribute :creates, Types::Any - attribute :parser, Types.Instance(ApiBlueprint::Parser).optional.default(ApiBlueprint::Parser.new) - attribute :replacements, Types::Hash.default(Hash.new) + attribute :parser, Types.Instance(ApiBlueprint::Parser).optional.default { ApiBlueprint::Parser.new } + attribute :replacements, Types::Hash.default { Hash.new } attribute :after_build, Types::Instance(Proc).optional - attribute :builder, Types.Instance(ApiBlueprint::Builder).default(ApiBlueprint::Builder.new) + attribute :builder, Types.Instance(ApiBlueprint::Builder).default { ApiBlueprint::Builder.new } attribute :log_responses, Types::Strict::Bool.default(false) attribute :timeout, Types::Strict::Integer.default(5) diff --git a/lib/api-blueprint/builder.rb b/lib/api-blueprint/builder.rb index 8215b12..7a5e267 100644 --- a/lib/api-blueprint/builder.rb +++ b/lib/api-blueprint/builder.rb @@ -1,10 +1,10 @@ module ApiBlueprint class Builder < ApiBlueprint::Struct - attribute :body, Types::Hash.default(Hash.new) - attribute :headers, Types::Hash.default(Hash.new) + attribute :body, Types::Hash.default { Hash.new } + attribute :headers, Types::Hash.default { Hash.new } attribute :status, Types::Integer.optional - attribute :replacements, Types::Hash.default(Hash.new) + attribute :replacements, Types::Hash.default { Hash.new } attribute :creates, Types::Any.optional attr_writer :body diff --git a/lib/api-blueprint/struct.rb b/lib/api-blueprint/struct.rb index 53f2489..a5060bf 100644 --- a/lib/api-blueprint/struct.rb +++ b/lib/api-blueprint/struct.rb @@ -3,7 +3,7 @@ class Struct < Dry::Struct transform_keys &:to_sym transform_types do |type| - type.default? ? type : type.meta(omittable: true) + type.default? ? type : type.omittable end def self.new(attributes = default_attributes) diff --git a/lib/api-blueprint/types.rb b/lib/api-blueprint/types.rb index 6ceb374..21ae47d 100644 --- a/lib/api-blueprint/types.rb +++ b/lib/api-blueprint/types.rb @@ -1,3 +1,3 @@ module Types - include Dry::Types.module + include Dry::Types() end