Module: Typekit::Element

Defined in:
lib/typekit/element.rb,
lib/typekit/element/base.rb,
lib/typekit/element/query.rb,
lib/typekit/element/association.rb,
lib/typekit/element/persistence.rb,
lib/typekit/element/serialization.rb

Defined Under Namespace

Modules: Association, Persistence, Query, Serialization Classes: Base

Class Method Summary collapse

Class Method Details

.build(name, *arguments) ⇒ Object



23
24
25
# File 'lib/typekit/element.rb', line 23

def self.build(name, *arguments)
  classify(name).new(*arguments)
end

.classify(name) ⇒ Object



19
20
21
# File 'lib/typekit/element.rb', line 19

def self.classify(name)
  dictionary[Helper.tokenize(name)]
end

.dictionaryObject



9
10
11
12
13
14
15
16
17
# File 'lib/typekit/element.rb', line 9

def self.dictionary
  @dictionary ||= Hash[
    ObjectSpace.each_object(Class).select do |klass|
      klass < Base && klass.name
    end.map do |klass|
      [Helper.tokenize(klass), klass]
    end
  ]
end