Implementation

Class: DataType. DataType subclasses DataInt.

Attributes

Constants

Methods

self.types()

def self.types()
return TYPES
end

Gets the DataTypes. Returns an Array containing the DataType type identifiers.

self.instance?(obj = nil)

def self.instance?(obj = nil)
boolean = false
TYPES.each { |type|
if (obj.is_a?(type))
boolean = true
end
}
return boolean
end

Predicate. Verifies an object is a DataType type instance. Takes an argument, any object. Returns true in the case the object is a Numeric, FalseClass, Symbol, TrueClass, or NilClass instance. Returns false otherwise.

self.type?(type = nil)

def self.type?(type = nil)
types_element = self.types_element?(type)
type_child = self.type_child?(type)
return (types_element || type_child)
end

Predicate. Verifies an identifier is a DataType identifier. Takes an argument identifier. Returns true in the case the argument is Numeric, FalseClass, Symbol, TrueClass , or NilClass, or, one of their ancestors. Returns false otherwise.

self.types_element?(type = nil)

def self.types_element?(type = nil)
boolean = TYPES.include?(type)
return boolean
end

Predicate. Verifies an identifier exists in the TYPES array. Takes any identifier argument. Returns true in the case the argument exists in the TYPES array. false otherwise.

self.type_child?(type = nil)

def self.type_child?(type = nil)
boolean = false
ancestor_array = type.ancestors()
if (type.class().equal?(Class))
ancestor_array.each { |ancestor|
if (TYPES.include?(ancestor))
boolean = true
end
}
end
return boolean
end

Predicate. Verifies an identifier is a TYPES element child. Takes an identifier argument. Returns true in the case the identifier is a TYPES element's child. false otherwise.