class Typekit::Collection::Base

Attributes

elements[R]
klass[R]

Public Class Methods

new(name, *arguments) click to toggle source
# File lib/typekit/collection/base.rb, line 15
def initialize(name, *arguments)
  objects = Helper.extract_array!(arguments)

  @elements = []
  @klass = Element.classify(name)
  connect(arguments.first, name)

  objects.each { |object| push(object) }
end

Public Instance Methods

<<(object)
Alias for: push
push(object) click to toggle source
# File lib/typekit/collection/base.rb, line 25
def push(object)
  if object.is_a?(klass)
    object.connect(self)
    elements << object
  else
    elements << klass.new(self, object)
  end
end
Also aliased as: <<