dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
module Web
module Blog
module Schemas
module Posts
Update = Dry::Validation.Form do
required(:id, :int).value(:int?)
required(:post).schema do
required(:title, :str).value(:str?)
required(:content, :str).value(:str?)
end
end
end
end
end
end
module Blog
module Validators
module Posts
Update = Dry::Validation.Schema do
required(:id)
required(:title).filled(min_size?: 3)
required(:content).filled(min_size?: 100)
end
end
end
end
require 'dry-validation'
module Blog
module Validators
module Posts
Update = Dry::Validation.Schema do
required(:id)
end
end
end
end
Blog::Validators::Posts::Update.({})
# => #<Dry::Validation::Result output={} messages={}>
.filled
is valid
Thing = Struct.new(:thing)
# => Thing
Thing.new("hi")
# => #<struct Thing thing="hi">
Array(Thing.new("hi"))
# => ["hi"]
# ಠ_ಠ - my struct object got totally stripped away
Struct#to_a
Message
in dry-v using Struct
then it turned out to be 2 x slower to instantiate than a custom class with a constructor and attr readers….
Struct
is no more…:)
ArgumentError: wrong number of arguments (1 for 0)
for initialize
the error points to the line def initialize
class IsobusExportAdapter
extend Dry::Initializer::Mixin
attr_reader :gis_api_params
option :application_map_id
option :field_id
option :strategy_bundle_id
option :worker
def initialize
end
end
IsobusExportAdapter.new(application_map_id: 43, field_id: field.id, strategy_bundle_id: bundle.id, worker: user)
def initialize(*args); super; # your-stuff; end
def initialize(*args)
super
end
gives me Failure/Error: super
ArgumentError:
wrong number of arguments (1 for 0)
super
but with just *args
doesn't fail, but it doesn't call the mixin initializer