Class: Autotype::TypeVariable

Inherits:
Object
  • Object
show all
Defined in:
lib/autotype/engine.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, id, hint = nil) ⇒ TypeVariable

Returns a new instance of TypeVariable.



191
192
193
194
195
# File 'lib/autotype/engine.rb', line 191

def initialize(scope, id, hint = nil)
  @scope = scope
  @id = id
  @hint = hint
end

Instance Attribute Details

#hintObject (readonly)

Returns the value of attribute hint.



189
190
191
# File 'lib/autotype/engine.rb', line 189

def hint
  @hint
end

#idObject (readonly)

Returns the value of attribute id.



189
190
191
# File 'lib/autotype/engine.rb', line 189

def id
  @id
end

#scopeObject (readonly)

Returns the value of attribute scope.



189
190
191
# File 'lib/autotype/engine.rb', line 189

def scope
  @scope
end

Instance Method Details

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


197
# File 'lib/autotype/engine.rb', line 197

def eql?(other) = other.is_a?(TypeVariable) && scope.equal?(other.scope) && id == other.id

#hashObject



198
# File 'lib/autotype/engine.rb', line 198

def hash = [scope.object_id, id].hash