Given a property defined as follows:
class Foo
include SmartProperties
property :bar, required: true, default: true
end
The following code works, as expected:
Foo.new # => #<Thing @bar=true>
Foo.new(bar: true) # => #<Thing @bar=true>
Foo.new(bar: false) # => #<Thing @bar=false>
However, explicitly providing the bar property as nil fails:
Foo.new(bar: nil)
# SmartProperties::MissingValueError: Foo requires the property bar to be set
Is this desired behaviour? It would seem logical that explicitly passing in nil should fall through to the default, which would satisfy the required constraint.
Given a property defined as follows:
The following code works, as expected:
However, explicitly providing the
barproperty asnilfails:Is this desired behaviour? It would seem logical that explicitly passing in
nilshould fall through to thedefault, which would satisfy therequiredconstraint.