Class: USaidWat::Either

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

Direct Known Subclasses

Left, Right

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Either

Returns a new instance of Either.



5
6
7
# File 'lib/usaidwat/either.rb', line 5

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



3
4
5
# File 'lib/usaidwat/either.rb', line 3

def value
  @value
end

Instance Method Details

#>>(&block) ⇒ Object

Raises:

  • (NoMethodError)


9
10
11
# File 'lib/usaidwat/either.rb', line 9

def >>(&block)
  raise NoMethodError, 'subclasses must define >>'
end

#left?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/usaidwat/either.rb', line 13

def left?
  false
end

#right?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/usaidwat/either.rb', line 17

def right?
  false
end