Class: RLTK::CG::NumberType Abstract

Inherits:
Type show all
Includes:
AbstractClass
Defined in:
lib/rltk/cg/type.rb

Overview

This class is abstract.

All types that are used to represent numbers inherit from this class.

Direct Known Subclasses

BasicIntType, RealType

Instance Attribute Summary

Attributes included from BindingClass

#ptr

Class Method Summary collapse

Instance Method Summary collapse

Methods included from AbstractClass

included

Methods inherited from Type

#allignment, #context, from_ptr, #hash, #initialize, #kind, #size

Methods included from BindingClass

#==

Constructor Details

This class inherits a constructor from RLTK::CG::Type

Class Method Details

.value_classValue

Returns The corresponding Value sub-class that is used to represent values of this type.

Returns:

  • (Value)

    The corresponding Value sub-class that is used to represent values of this type.



109
110
111
112
113
114
115
116
117
# File 'lib/rltk/cg/type.rb', line 109

def self.value_class
	begin
		@value_class ||=
		RLTK::CG.const_get(self.name.match(/::(.+)Type$/).captures.last.to_sym)
		
	rescue
		raise "#{self.name} has no value class."
	end
end

Instance Method Details

#value_classValue

Returns The corresponding Value sub-class that is used to represent values of this type.

Returns:

  • (Value)

    The corresponding Value sub-class that is used to represent values of this type.



120
121
122
# File 'lib/rltk/cg/type.rb', line 120

def value_class
	self.class.value_class
end