Class: RubyBreaker::TypeDefs::FusionType

Inherits:
DuckType show all
Defined in:
lib/rubybreaker/type/type.rb

Overview

This class represents any object that has certain methods whose types are same as the given nominal type’s counterparts. Usage: nominal_type

Instance Attribute Summary collapse

Attributes inherited from DuckType

#meth_names

Attributes inherited from Type

#ctx

Instance Method Summary collapse

Methods inherited from DuckType

#add_meth

Methods inherited from Type

#eql?, #subtype_of?, #unparse

Constructor Details

#initialize(nom_type, meth_names = [], *args) ⇒ FusionType

Returns a new instance of FusionType.



140
141
142
143
# File 'lib/rubybreaker/type/type.rb', line 140

def initialize(nom_type,meth_names=[],*args)
  super(meth_names,*args)
  @nom_type = nom_type
end

Instance Attribute Details

#nom_typeObject

This accessor sets/gets the nominal type to which the method names are bound.



138
139
140
# File 'lib/rubybreaker/type/type.rb', line 138

def nom_type
  @nom_type
end

Instance Method Details

#modObject

This method gets the actual module of the nominal type for this fusion type. This is a shorthand for t1.nom_type.mod().



147
148
149
# File 'lib/rubybreaker/type/type.rb', line 147

def mod()
  return @nom_type.mod
end