Sha256: 2139e402ead58bdf455912ffa6bb832a3b944f0fef1586f9c2bbf67fc4bb44e8

Contents?: true

Size: 356 Bytes

Versions: 1

Compression:

Stored size: 356 Bytes

Contents

class Class
  def __tc_collection_root()
    root = self
    while root.superclass && root.superclass.include?(TypeCollection::Base)
      root = root.superclass
    end
    root
  end

  def inferred_type()
    klass_name = self.name.split("::").last
    root_name = __tc_collection_root.name.split("::").last
    klass_name.gsub(root_name, "")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
typecollection-0.0.11 lib/typecollection/class+inferred_type.rb