Sha256: 2c3017482d43fbe124593841accb3d3b0b2df7387b40a6a08f0707b79a3cb1f0

Contents?: true

Size: 800 Bytes

Versions: 1

Compression:

Stored size: 800 Bytes

Contents

require_relative 'record/base'
require_relative 'record/family'
require_relative 'record/variation'
require_relative 'record/kit'
require_relative 'record/library'

module Typekit
  module Record
    def self.classes
      @classes ||= ObjectSpace.each_object(Class).select do |klass|
        klass < Base
      end
    end

    def self.collections
      @collections ||= members.map(&:to_s).map do |name|
        Helper.pluralize(name.to_s)
      end.map(&:to_sym)
    end

    def self.members
      @members ||= classes.map(&:to_s).map(&:downcase).map do |name|
        name.sub(/^.*::/, '')
      end.map(&:to_sym)
    end

    def self.collection?(name)
      collections.include?(name.to_s.to_sym)
    end

    def self.member?(name)
      members.include?(name.to_s.to_sym)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
typekit-client-0.0.4 lib/typekit/record.rb