Module: Resulting::Resultable::ClassMethods

Defined in:
lib/resulting/resultable.rb

Instance Method Summary collapse

Instance Method Details

#failure(value) ⇒ Object



34
35
36
# File 'lib/resulting/resultable.rb', line 34

def failure(value)
  new(false, value)
end

#success(value) ⇒ Object



30
31
32
# File 'lib/resulting/resultable.rb', line 30

def success(value)
  new(true, value)
end

#wrap(param) ⇒ Object



38
39
40
41
42
# File 'lib/resulting/resultable.rb', line 38

def wrap(param)
  return param if param.is_a?(Resulting::Resultable)

  success(param)
end