lib/evil/client/model.rb in evil-client-3.0.4 vs lib/evil/client/model.rb in evil-client-3.1.0
- old
+ new
@@ -89,13 +89,13 @@
# Model instance constructor
#
# @param [Hash] op Model options
# @return [Evil::Client::Model]
#
- def new(op = {})
- op = Hash(op).each_with_object({}) { |(k, v), obj| obj[k.to_sym] = v }
- super(op).tap { |item| in_english { policy[item].validate! } }
+ def new(**op)
+ op = Hash(op).transform_keys(&:to_sym)
+ super(**op).tap { |item| in_english { policy[item].validate! } }
end
alias call new
alias [] call
private
@@ -114,10 +114,10 @@
raise TypeError, "#{other} is not a subclass of Evil::Client::Model"
end
def extend_model(other)
other.dry_initializer.options.each do |definition|
- option definition.source, definition.options
+ option definition.source, **definition.options
end
other.lets.each { |key, block| let(key, &block) }
other.policy.validators.each do |validator|