Class: Lego::Either::Fail

Inherits:
Object
  • Object
show all
Includes:
Eitherish
Defined in:
lib/lego/either.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Eitherish

#next, #none?, #value?

Constructor Details

#initialize(error) ⇒ Fail

Returns a new instance of Fail.



75
76
77
# File 'lib/lego/either.rb', line 75

def initialize(error)
  @error = error
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



79
80
81
# File 'lib/lego/either.rb', line 79

def error
  @error
end

Instance Method Details

#error?Boolean

Returns:



81
82
83
# File 'lib/lego/either.rb', line 81

def error?
  true
end

#inspectObject



85
86
87
# File 'lib/lego/either.rb', line 85

def inspect
  "<Lego::Either::Fail '#{error}'>"
end