Class: Stupidedi::Either

Inherits:
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:



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

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

.success(value) ⇒ Success

Returns:



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

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

Instance Method Details

#defined?Boolean

Returns:

  • (Boolean)


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

abstract :defined?

#explainEither

Returns:



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

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

#fetchObject

Returns:



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

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

#flatmapEither

Returns:



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

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

#mapEither

Returns:



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

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

#orEither

Returns:



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

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

#rejectEither

Returns:



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

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

#selectEither

Returns:



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

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