Class: Steep::Subtyping::Result::Expand

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

Instance Attribute Summary collapse

Attributes inherited from Base

#relation

Instance Method Summary collapse

Methods inherited from Base

#else, #failure?, #then

Constructor Details

#initialize(relation, &block) ⇒ Expand

Returns a new instance of Expand.



55
56
57
58
59
60
# File 'lib/steep/subtyping/result.rb', line 55

def initialize(relation, &block)
  super relation
  @child = yield relation

  raise if @child == true
end

Instance Attribute Details

#childObject (readonly)

Returns the value of attribute child.



53
54
55
# File 'lib/steep/subtyping/result.rb', line 53

def child
  @child
end

Instance Method Details

#failure_path(path = []) ⇒ Object



66
67
68
69
70
71
# File 'lib/steep/subtyping/result.rb', line 66

def failure_path(path = [])
  if child.failure?
    path.unshift(self)
    child.failure_path(path)
  end
end

#success?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/steep/subtyping/result.rb', line 62

def success?
  child.success?
end