Class: Try::Success

Inherits:
Base
  • Object
show all
Defined in:
lib/trither/try.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Try::Base

Instance Method Details

#fail_mapObject



49
50
51
# File 'lib/trither/try.rb', line 49

def fail_map
  self
end

#failure?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/trither/try.rb', line 37

def failure?
  false
end

#flat_map {|@value| ... } ⇒ Object

Yields:

  • (@value)


41
42
43
# File 'lib/trither/try.rb', line 41

def flat_map
  yield @value
end

#get_or_elseObject



53
54
55
# File 'lib/trither/try.rb', line 53

def get_or_else
  @value
end

#mapObject



45
46
47
# File 'lib/trither/try.rb', line 45

def map
  Success.new(yield @value)
end