Dentaku!("a OR b", a: true) raises, but probably should return true?
vlazar opened this issue · 1 comments
vlazar commented
This one raises error as b
was not provided.
Dentaku!("a OR b", a: true) # => Dentaku::UnboundVariableError
Semantically since a
is true, the value of a OR b
is true
no matter what is the value ofb
.
Would it make sense for Dentaku to raise Dentaku::UnboundVariableError
only if a
has falsy value and b
is missing?
agrberg commented
The behavior above makes sense to me though my gut says it could be a little tough to implement. If you're looking for a workaround, it will function as described so as b
is specify and it can be nil
.
Dentaku!("a OR b", a: true, b: method_that_returns_b_or_nil) # could also use an `@ivar` to get the `nil` behavior when not set
# => true