Class: Stupidedi::Either

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

Direct Known Subclasses

Failure, Success

Defined Under Namespace

Classes: Failure, Success

Filtering the Value collapse

Transforming the Value collapse

Constructors collapse

Instance Method Summary collapse

Class Method Details

.failure(reason) ⇒ Failure

Returns:


274
275
276
# File 'lib/stupidedi/either.rb', line 274

def failure(reason)
  Either::Failure.new(reason)
end

.success(value) ⇒ Success

Returns:


269
270
271
# File 'lib/stupidedi/either.rb', line 269

def success(value)
  Either::Success.new(value)
end

Instance Method Details

#defined?Boolean

Returns:

  • (Boolean)

7
# File 'lib/stupidedi/either.rb', line 7

abstract :defined?

#explain(&block) ⇒ Either

Returns:


34
# File 'lib/stupidedi/either.rb', line 34

abstract :explain, :args => %w(&block)

#fetch(default) ⇒ Object

Returns:

  • (Object)

37
# File 'lib/stupidedi/either.rb', line 37

abstract :fetch, :args => %w(default)

#flatmap(&block) ⇒ Either

Returns:


28
# File 'lib/stupidedi/either.rb', line 28

abstract :flatmap, :args => %w(&block)

#map(&block) ⇒ Either

Returns:


25
# File 'lib/stupidedi/either.rb', line 25

abstract :map, :args => %w(&block)

#or(&block) ⇒ Either

Returns:


31
# File 'lib/stupidedi/either.rb', line 31

abstract :or, :args => %w(&block)

#reject(reason = 'reject', &block) ⇒ Either

Returns:


16
# File 'lib/stupidedi/either.rb', line 16

abstract :reject, :args => %w(reason='reject' &block)

#select(reason = 'select', &block) ⇒ Either

Returns:


13
# File 'lib/stupidedi/either.rb', line 13

abstract :select, :args => %w(reason='select' &block)