Provide something like dry-initializer solves
Closed this issue · 1 comments
Goltergaul commented
Provide functionality to define and validate the initialization arguments of a class in an easy way. e.g.
class MyClass
include Definition::Initializer
required :username, Definition.Type(String)
optional :scores, Definition.Type(Array)
def hello
puts "Hello #{username}"
end
end
instance = MyClass.new(username: "Fred", scores: [1,2,3])
instance.hello # => "Hello Fred"
this would only support keyword arguments though
Feedback welcome :)
Goltergaul commented
see #39