Class: Class

Inherits:
Object show all
Defined in:
lib/typecollection/class+inferred_type.rb

Instance Method Summary collapse

Instance Method Details

#inferred_typeObject



2
3
4
5
6
7
8
9
10
11
12
13
# File 'lib/typecollection/class+inferred_type.rb', line 2

def inferred_type()
  klass_name   = self.name.split("::").last
  parent_klass = self.superclass
  while(parent_klass != nil)
    check = /#{parent_klass.name.split("::").last}$/
    if (klass_name.match(check))
      return klass_name.gsub(check, '')
    end
    parent_klass = parent_klass.superclass
  end
  return nil
end