Module: Typekit::MassAssignment Abstract

Included in:
Family, Kit, Library, Variation
Defined in:
lib/typekit/base.rb

Overview

This module is abstract.

Contains mass assignment functionality for building objects out of hashes.

Instance Method Summary collapse

Instance Method Details

#initialize(attributes = {}) ⇒ Object



5
6
7
# File 'lib/typekit/base.rb', line 5

def initialize(attributes = {})
  mass_assign(attributes)
end

#mass_assign(attributes) ⇒ Object



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

def mass_assign(attributes)
  attributes.each do |attribute, value|
    respond_to?(:"#{attribute}=") && send(:"#{attribute}=", value)
  end
end