Class: Right

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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Either

#match

Constructor Details

#initialize(value) ⇒ Right

Returns a new instance of Right.



8
9
10
# File 'lib/right.rb', line 8

def initialize(value)
  @value = value
end

Class Method Details

.[](value) ⇒ Object



4
5
6
# File 'lib/right.rb', line 4

def self.[] value
  new value
end

Instance Method Details

#leftObject



12
13
14
# File 'lib/right.rb', line 12

def left
  None
end

#left?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/right.rb', line 20

def left?
  false
end

#rightObject



16
17
18
# File 'lib/right.rb', line 16

def right
  Some[value]
end

#right?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/right.rb', line 24

def right?
  true
end