Sha256: 840d598c63d9b12eed03c5fd988125d10e3608dfe662d4f5850ade3092f8d696

Contents?: true

Size: 515 Bytes

Versions: 1

Compression:

Stored size: 515 Bytes

Contents

class Class
  def inferred_type()
    if (!defined?(@__tc_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.end_with?(check))
          @__tc_inferred_type = klass_name.gsub(/#{check}\z/, "")
          break
        end
        parent_klass = parent_klass.superclass
      end
      @__tc_inferred_type = nil
    end
    return @__tc_inferred_type
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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