Class: Ruber::Project
- Inherits:
-
AbstractProject
- Object
- Qt::Object
- AbstractProject
- Ruber::Project
- Includes:
- Activable
- Defined in:
- lib/ruber/project.rb
Overview
Class representing a global project (one which should be managed by ProjectList).
It uses ProjectBackend as backend and includes the Activable module.
Signals
activated()
Signal emitted when the project is activated
deactivated()
Signal emitted when the project is deactivated
Slots
-
activate()
-
deactivate()
Defined Under Namespace
Classes: InvalidProjectFileName
Instance Attribute Summary
Attributes inherited from AbstractProject
Instance Method Summary collapse
-
#add_option(opt) ⇒ Object
Override of
SettingsContainer#add_option
which sets the type of opt to:global
ifopt.type
returns nil. -
#close(save = true) ⇒ Object
Override of
AbstractProject#close
which deactivates the project before closing it and disposes of it after closing. -
#files ⇒ Object
Override of AbstractProject#files which actually returns the list of files belonging to the project.
-
#initialize(file, name = nil) ⇒ Project
constructor
Creates a new Project.
-
#scope ⇒ Object
Reimplementation of
AbstractProject#scope
which returns:global
.
Methods included from Activable
#activate, #active=, #active?, #deactivate
Methods inherited from AbstractProject
#[]=, #add_extension, #each_extension, #extension, #extensions, #has_extension?, #match_rule?, #method_missing, #project_directory, #query_close, #remove_extension, #save, #write
Methods included from SettingsContainer
#[], #[]=, #add_setting, #add_widget, #default, #dialog, #has_setting?, #relative_path?, #remove_setting, #remove_widget, #write
Constructor Details
#initialize(file, name = nil) ⇒ Project
Creates a new Project. file is the name of the project file, while name is the project name. You must specify both arguments if the file file doesn’t exist, while you must not pass the name parameter if the file file already exists (in this case, the project name is written in the project file and there’s no need to specify it). Note that this method takes care of creating the backend, so you don’t need to do that yourself (unlike with AbstractProject).
If file is a relative path, it’s considered relative to the current directory.
If the project file file already exists but it’s not a valid project file, AbstractProject::InvalidProjectFile will be raised.
374 375 376 377 378 379 380 381 |
# File 'lib/ruber/project.rb', line 374 def initialize file, name = nil file = File.join(Dir.pwd, file) unless file.start_with? '/' back = begin ProjectBackend.new file rescue YamlSettingsBackend::InvalidSettingsFile => e raise Ruber::AbstractProject::InvalidProjectFile, e. end super Ruber[:world], back, name end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Ruber::AbstractProject
Instance Method Details
#add_option(opt) ⇒ Object
Override of SettingsContainer#add_option
which sets the type of opt to :global
if opt.type
returns nil.
This is necessary because AbstractProject.new
adds the :project_name
option without specifying its type.
408 409 410 411 |
# File 'lib/ruber/project.rb', line 408 def add_option opt opt.type ||= :global super end |
#close(save = true) ⇒ Object
Override of AbstractProject#close
which deactivates the project before closing it and disposes of it after closing. Aside from this, it works as the base class version.
387 388 389 390 391 392 |
# File 'lib/ruber/project.rb', line 387 def close save = true deactivate res = super dispose res end |
#files ⇒ Object
Override of AbstractProject#files which actually returns the list of files belonging to the project.
Note: this method uses the project_files
extension
419 420 421 |
# File 'lib/ruber/project.rb', line 419 def files @project_extensions[:project_files].project_files end |
#scope ⇒ Object
Reimplementation of AbstractProject#scope
which returns :global
397 398 399 |
# File 'lib/ruber/project.rb', line 397 def scope :global end |