Skip to content

Commit

Permalink
Merge pull request #162 from wadetandy/master
Browse files Browse the repository at this point in the history
Upgrade to dry-types 1.x
  • Loading branch information
richmolj authored Jul 16, 2019
2 parents 6902255 + 5a00b0f commit 870c279
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion graphiti.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Gem::Specification.new do |spec|

spec.add_dependency "jsonapi-serializable", "~> 0.3.0"
spec.add_dependency "jsonapi-renderer", "0.2.0"
spec.add_dependency "dry-types", "~> 0.15"
spec.add_dependency "dry-types", ">= 0.15.0", "< 2.0"
spec.add_dependency "graphiti_errors", "~> 1.1.0"
spec.add_dependency "concurrent-ruby", "~> 1.0"
spec.add_dependency "activesupport", ">= 4.1"
Expand Down
9 changes: 5 additions & 4 deletions lib/graphiti/types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def self.create(primitive, &blk)
::DateTime.parse(input.to_s)
end
end
input = Dry::Types["json.date_time"][input]
input = Dry::Types["json.date_time"][input] if input.is_a?(::String)
Dry::Types["strict.date_time"][input] if input
}

Expand All @@ -25,7 +25,8 @@ def self.create(primitive, &blk)
::DateTime.parse(input.to_s)
end
end
input = Dry::Types["json.date_time"][input]

input = Dry::Types["json.date_time"][input] if input.is_a?(::String)
Dry::Types["strict.date_time"][input].iso8601 if input
}

Expand All @@ -36,13 +37,13 @@ def self.create(primitive, &blk)

Date = create(::Date) { |input|
input = ::Date.parse(input.to_s) if input.is_a?(::Time)
input = Dry::Types["json.date"][input]
input = Dry::Types["json.date"][input] if input.is_a?(::String)
Dry::Types["strict.date"][input] if input
}

PresentDate = create(::Date) { |input|
input = ::Date.parse(input.to_s) if input.is_a?(::Time)
input = Dry::Types["json.date"][input]
input = Dry::Types["json.date"][input] if input.is_a?(::String)
Dry::Types["strict.date"][input]
}

Expand Down

0 comments on commit 870c279

Please sign in to comment.