Sha256: 867d141dd6bc4c406c797b2a43a623178ab85da552da8327471bf042a8374406

Contents?: true

Size: 359 Bytes

Versions: 3

Compression:

Stored size: 359 Bytes

Contents

class Class
  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
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
typecollection-0.0.9 lib/typecollection/class+inferred_type.rb
typecollection-0.0.8 lib/typecollection/class+inferred_type.rb
typecollection-0.0.7 lib/typecollection/class+inferred_type.rb