class Right

Attributes

val[R]

Public Class Methods

new(val) click to toggle source
# File lib/either.rb, line 44
def initialize(val)
  @val = val
end

Public Instance Methods

==(other) click to toggle source
# File lib/either.rb, line 57
def == (other)
  other.is_a?(Right) && other.val == @val
end
flatten() click to toggle source
# File lib/either.rb, line 61
def flatten
  @val
end
fold(left, right) click to toggle source
# File lib/either.rb, line 65
def fold (left, right)
  right.call(@val)
end
left?() click to toggle source
# File lib/either.rb, line 48
def left?; false end
right?() click to toggle source
# File lib/either.rb, line 49
def right?; true end
to_a() click to toggle source
# File lib/either.rb, line 51
def to_a; [@val] end
transform(f) click to toggle source
# File lib/either.rb, line 53
def transform(f)
  Right.new(f.call(@val))
end