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.



648
649
650
# File 'lib/yadriggy/type.rb', line 648

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.



675
676
677
# File 'lib/yadriggy/type.rb', line 675

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

#supertypeType

Returns the super type.

Returns:

  • (Type)

    the super type.



714
715
716
# File 'lib/yadriggy/type.rb', line 714

def supertype
  @type.supertype
end