Class: Right

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

Instance Method Summary collapse

Methods included from Either

#<=>, #bimap, #each, #flat_map, #get_or_else, #initialize, #inspect, #left?, #left_map, lefts, #map, #or_else, partition, rights, #to_a, try, #~@

Methods included from UnionType

#when

Methods included from Helper

#alias_names

Methods included from Control::Monad

#>>, #flat_map

Methods included from Control::Applicative

#apply

Methods included from Control::Functor

#map

Instance Method Details

#==(other) ⇒ Object



254
255
256
257
258
259
260
261
# File 'lib/data.either.rb', line 254

def ==(other)
  case other
  when Right
    other.map { |v| return v == @v }
  else
    false
  end
end

#right?Boolean

always true

Returns:

  • (Boolean)


250
251
252
# File 'lib/data.either.rb', line 250

def right?
  true
end