Module: Typekit::Record

Defined in:
lib/typekit/record.rb,
lib/typekit/record/kit.rb,
lib/typekit/record/base.rb,
lib/typekit/record/family.rb,
lib/typekit/record/library.rb,
lib/typekit/record/variation.rb

Defined Under Namespace

Classes: Base, Family, Kit, Library, Variation

Class Method Summary collapse

Class Method Details

.classesObject



9
10
11
12
13
# File 'lib/typekit/record.rb', line 9

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

.collection?(name) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/typekit/record.rb', line 27

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

.collectionsObject



15
16
17
18
19
# File 'lib/typekit/record.rb', line 15

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

.member?(name) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/typekit/record.rb', line 31

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

.membersObject



21
22
23
24
25
# File 'lib/typekit/record.rb', line 21

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