Class: Either::Left

Inherits:
Object
  • Object
show all
Includes:
Shared
Defined in:
lib/either.rb

Instance Method Summary collapse

Methods included from Shared

#==, #val_eq?

Constructor Details

#initialize(val) ⇒ Left

Returns a new instance of Left.



35
36
37
# File 'lib/either.rb', line 35

def initialize(val)
  @val = val
end

Instance Method Details

#flat_map(&block) ⇒ Object



43
44
45
# File 'lib/either.rb', line 43

def flat_map(&block)
  self
end

#left?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/either.rb', line 28

def left?
  true
end

#map(&block) ⇒ Object



39
40
41
# File 'lib/either.rb', line 39

def map(&block)
  self
end

#right?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/either.rb', line 31

def right?
  false
end