Class: Yadriggy::OptionalRole

Inherits:
Type
  • Object
show all
Defined in:
lib/yadriggy/type.rb

Overview

A role that can be attached to a Type object. It makes a chain of Type objects.

Instance Method Summary collapse

Methods inherited from Type

#!=, #eql?, error_found!, #name, role

Constructor Details

#initialize(type) ⇒ OptionalRole

Returns a new instance of OptionalRole.

Parameters:

  • type (Type)

    a Type object that this role is added to.



635
636
637
# File 'lib/yadriggy/type.rb', line 635

def initialize(type)
  @type = type
end

Instance Method Details

#==(t) ⇒ Object

Checks the equality. The roles (a Yadriggy::OptionalRole objects) in the chain are ignored when objects are compared.



662
663
664
# File 'lib/yadriggy/type.rb', line 662

def == (t)
  @type == t
end

#supertypeType

Returns the super type.

Returns:

  • (Type)

    the super type.



701
702
703
# File 'lib/yadriggy/type.rb', line 701

def supertype
  @type.supertype
end