Class: Steep::AST::Types::Logic::Env

Inherits:
Base show all
Defined in:
lib/steep/ast/types/logic.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#level, #subst

Methods included from SharedInstance

#instance

Methods included from Helper::NoChild

#each_child, #map_type

Methods included from Helper::NoFreeVariables

#free_variables

Constructor Details

#initialize(truthy:, falsy:, type:) ⇒ Env

Returns a new instance of Env.



59
60
61
62
63
# File 'lib/steep/ast/types/logic.rb', line 59

def initialize(truthy:, falsy:, type:)
  @truthy = truthy
  @falsy = falsy
  @type = type
end

Instance Attribute Details

#falsyObject (readonly)

Returns the value of attribute falsy.



57
58
59
# File 'lib/steep/ast/types/logic.rb', line 57

def falsy
  @falsy
end

#truthyObject (readonly)

Returns the value of attribute truthy.



57
58
59
# File 'lib/steep/ast/types/logic.rb', line 57

def truthy
  @truthy
end

#typeObject (readonly)

Returns the value of attribute type.



57
58
59
# File 'lib/steep/ast/types/logic.rb', line 57

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



65
66
67
# File 'lib/steep/ast/types/logic.rb', line 65

def ==(other)
  other.is_a?(Env) && other.truthy == truthy && other.falsy == falsy && other.type == type
end

#hashObject



71
72
73
# File 'lib/steep/ast/types/logic.rb', line 71

def hash
  self.class.hash ^ truthy.hash ^ falsy.hash
end

#inspectObject Also known as: to_s



75
76
77
# File 'lib/steep/ast/types/logic.rb', line 75

def inspect
  "#<Steep::AST::Types::Env @type=#{type}, @truthy=..., @falsy=...>"
end