Skip to content

Commit

Permalink
Add Types module and use in definitions
Browse files Browse the repository at this point in the history
Use the new `ROM::CSV::Types` module in the params/options definitions
throughout.
  • Loading branch information
elskwid committed Feb 26, 2017
1 parent abb1651 commit d12024a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/rom/csv/dataset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ module CSV
class Dataset < ROM::Memory::Dataset
option :path,
optional: true,
type: Dry::Types['strict.string']
type: Types::Strict::String
option :file_options,
default: proc { {} },
type: Dry::Types['strict.hash']
type: Types::Strict::Hash

# Convert each CSV::Row to a hash
#
Expand Down
4 changes: 2 additions & 2 deletions lib/rom/csv/gateway.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ class Gateway < ROM::Gateway

param :path,
reader: :private,
type: Dry::Types['strict.string']
type: Types::Strict::String
param :csv_options,
default: proc { {} },
reader: :private,
type: Dry::Types['strict.hash']
type: Types::Strict::Hash

# @api private
attr_reader :datasets
Expand Down
9 changes: 9 additions & 0 deletions lib/rom/csv/types.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require 'rom/types'

module ROM
module CSV
module Types
include ROM::Types
end
end
end

0 comments on commit d12024a

Please sign in to comment.