You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd love to be able to use nil or present (or similar), rather than have to check to see if the object is nil, [], or [Object].
Second possibility
All non-initialized elements with qty 0..1 could be initialized to [] instead of nil. That way, at least we can access something with [0] and see if it's nil, rather than doing .try(:[], 0), which is a little goofy.
The text was updated successfully, but these errors were encountered:
Thanks for reporting this issue/suggestion and sorry for the delay in responding to this!
I think the suggestion makes sense and is something we should support in the library (without having to resort to wrapping it in an Array or jumping through other hoops).
Currently the library will "inflate" these complex elements if they are provided as a simple Hash. e.g.
Single (non-Array-wrapped) values can be assigned to elements, but not at initialization. Consider this code sample:
I'd love to be able to use
nil
orpresent
(or similar), rather than have to check to see if the object isnil
,[]
, or[Object]
.Second possibility
All non-initialized elements with qty
0..1
could be initialized to[]
instead ofnil
. That way, at least we can access something with[0]
and see if it'snil
, rather than doing.try(:[], 0)
, which is a little goofy.The text was updated successfully, but these errors were encountered: