Method: Ruber::AbstractProject#close

Defined in:
lib/ruber/project.rb

#close(save = true) ⇒ Boolean

Closes the project

According to the save parameter, the project may save itself and its extensions' settings or not. In the first case, extensions may stop the project from closing by having their @query_close@ method return false. If save is false, nothing will be saved and the closing can’t be interrupted.

Before closing the project, the #closing signal is emitted. After that, all extensions will be removed (calling their @remove_from_project@ method if they have one).

Parameters:

  • save (Boolean) (defaults to: true)

    whether or not to save the project and the extensions' settings. If true, the extensions will also have a chance to abort closing by returning false from their @query_close@ method

Returns:

  • (Boolean)

    true if the project was closed correctly and false if the project couldn't be closed, either because some of the extensions' @query_close@ method returned false or because the project itself couldn't be saved for some reason.



310
311
312
313
314
315
316
317
318
319
320
# File 'lib/ruber/project.rb', line 310

def close save = true
  if save
    return false unless query_close
    return false unless self.save
  end
  emit closing(self)
  @project_extensions.each_key{|k| remove_extension k}
  Ruber[:components].named_disconnect "remove_component_from_project #{object_id}"
  Ruber[:components].named_disconnect "register_component_with_project #{object_id}"
  true
end