lib/iron_oxide/option.rb in iron_oxide-0.0.1 vs lib/iron_oxide/option.rb in iron_oxide-0.0.2
- old
+ new
@@ -3,9 +3,18 @@
module IronOxide
module Option
class Base
attr_reader :value
+ # Deconstructs the instance into an array.
+ def deconstruct
+ [value]
+ end
+
+ def deconstruct_keys(*)
+ {value:}
+ end
+
# Checks if the instance represents a `Some` value.
def some?
instance_of?(SomeClass)
end