module Typekit::Record

Public Class Methods

build(name, client) click to toggle source
# File lib/typekit/record.rb, line 16
def self.build(name, client)
  klass = Element.classify(name)
  Class.new(klass) do
    extend Client::Proxy

    connect(client, Helper.tokenize(name))

    singleton_class.instance_eval do
      define_method(:new) do |*arguments|
        klass.new(client, *arguments)
      end
    end
  end
end
identify(name) click to toggle source
# File lib/typekit/record.rb, line 8
def self.identify(name)
  if Element.dictionary.key?(Helper.tokenize(name, pluralize: false))
    :collection
  elsif Element.dictionary.key?(Helper.tokenize(name))
    :element
  end
end