Module: Rstructural::Option

Extended by:
ADT
Defined in:
lib/rstructural/option.rb

Constant Summary collapse

Some =
data :value
None =
const do
  def value
    nil
  end
end

Class Method Summary collapse

Methods included from ADT

const, data, extended, interface

Class Method Details

.of(obj) ⇒ Object



14
15
16
# File 'lib/rstructural/option.rb', line 14

def self.of(obj)
  obj.nil? ? None : Some.new(obj)
end