Class: Rubex::DataType::TypeDef

Inherits:
Object
  • Object
show all
Defined in:
lib/rubex/data_type/type_def.rb

Overview

FIXME: Find out a better way to generically find the old type of a typedef

when the new type is encountered. Should cover cases where the new type
is aliased with some other name too. In other words, reach the actual
type in the most generic way possible without too many checks.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(old_type, new_type, type) ⇒ TypeDef

Returns a new instance of TypeDef.



11
12
13
14
15
# File 'lib/rubex/data_type/type_def.rb', line 11

def initialize(old_type, new_type, type)
  @old_type = old_type
  @new_type = new_type
  @type = type
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object



29
30
31
# File 'lib/rubex/data_type/type_def.rb', line 29

def method_missing(meth, *args, &block)
  @old_type.send(meth, *args, &block)
end

Instance Attribute Details

#new_typeObject (readonly)

include Helpers



9
10
11
# File 'lib/rubex/data_type/type_def.rb', line 9

def new_type
  @new_type
end

#old_typeObject (readonly)

include Helpers



9
10
11
# File 'lib/rubex/data_type/type_def.rb', line 9

def old_type
  @old_type
end

#typeObject (readonly)

include Helpers



9
10
11
# File 'lib/rubex/data_type/type_def.rb', line 9

def type
  @type
end

Instance Method Details

#alias_type?Boolean

Returns:



17
18
19
# File 'lib/rubex/data_type/type_def.rb', line 17

def alias_type?
  true
end

#base_typeObject



25
26
27
# File 'lib/rubex/data_type/type_def.rb', line 25

def base_type
  @old_type
end

#to_sObject



21
22
23
# File 'lib/rubex/data_type/type_def.rb', line 21

def to_s
  @new_type.to_s
end