Class: Types::Type Abstract

Inherits:
Object show all
Defined in:
lib/types.rb

Overview

This class is abstract.

Type defining class.

Direct Known Subclasses

Boolean

Instance Method Summary collapse

Instance Method Details

#match_type?(object) ⇒ Boolean

Matches object is of this type.

 @param [Object] object object for type matching

Returns:

  • (Boolean)

    ‘true’ if match, ‘false’ in otherwise



46
47
48
49
50
51
52
53
# File 'lib/types.rb', line 46

def match_type?(object)
    result = object.kind_of_any? self.type_classes
    if not result
        result = object.type_of_any? self.type_types
    end
    
    return result
end

#type_classesArray

This method is abstract.

Returns classes which are part of this type.

Returns:

  • (Array)

    array of class objects

Raises:

  • (Exception)


26
27
28
# File 'lib/types.rb', line 26

def type_classes
    raise Exception::new("Class is abstract.")
end

#type_typesArray

Returns types which are part of this type.

Returns:

  • (Array)

    array of types objects



35
36
37
# File 'lib/types.rb', line 35

def type_types
    [ ]
end