Method: Typekit::Kit#save

Defined in:
lib/typekit/kit.rb

#save(publish_after_save = true) ⇒ Boolean

Save kit attributes like name and domains. This does not alter the families added to the kit.

Parameters:

  • (defaults to: true)

    Commit changes saved to the published kit. See #publish.

Returns:

  • Status of the operation (including the publishing, if it is called)



81
82
83
84
85
86
87
88
89
# File 'lib/typekit/kit.rb', line 81

def save(publish_after_save = true)
  attributes = [:name, :badge, :domains].inject({}) { |attributes, x| attributes[x] = instance_variable_get("@#{x}"); attributes }
  result = mass_assign Client.post("/kits/#{@id}", :query => attributes)
  published = publish if publish_after_save
  
  # For the parenthesized statement, true && true or false && false are acceptable.
  # but xor does the exact opposite, so we negate it.
  result && !(publish_after_save ^ published)
end