Class: Steep::Subtyping::Result::Failure

Inherits:
Base
  • Object
show all
Defined in:
lib/steep/subtyping/result.rb

Defined Under Namespace

Classes: BlockMismatchError, MethodMissingError, ParameterMismatchError, PolyMethodSubtyping, UnknownPairError

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#else, #failure?, #then

Constructor Details

#initialize(error:, trace:) ⇒ Failure

Returns a new instance of Failure.



102
103
104
105
# File 'lib/steep/subtyping/result.rb', line 102

def initialize(error:, trace:)
  @error = error
  @trace = trace.dup
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



99
100
101
# File 'lib/steep/subtyping/result.rb', line 99

def error
  @error
end

#traceObject (readonly)

Returns the value of attribute trace.



100
101
102
# File 'lib/steep/subtyping/result.rb', line 100

def trace
  @trace
end

Instance Method Details

#drop(n) ⇒ Object



120
121
122
# File 'lib/steep/subtyping/result.rb', line 120

def drop(n)
  self.class.new(error: error, trace: trace.drop(n))
end

#merge_trace(trace) ⇒ Object



111
112
113
114
115
116
117
118
# File 'lib/steep/subtyping/result.rb', line 111

def merge_trace(trace)
  if trace.empty?
    self
  else
    self.class.new(error: error,
                   trace: trace + self.trace)
  end
end

#success?Boolean

Returns:

  • (Boolean)


107
108
109
# File 'lib/steep/subtyping/result.rb', line 107

def success?
  false
end