Class: DesignManagement::DesignCollection
- Inherits:
-
Object
- Object
- DesignManagement::DesignCollection
- Defined in:
- app/models/design_management/design_collection.rb
Instance Attribute Summary collapse
-
#issue ⇒ Object
readonly
Returns the value of attribute issue.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #designs_by_filename(filenames) ⇒ Object
- #find_or_create_design!(filename:) ⇒ Object
-
#initialize(issue) ⇒ DesignCollection
constructor
A new instance of DesignCollection.
- #repository ⇒ Object
- #versions ⇒ Object
Constructor Details
#initialize(issue) ⇒ DesignCollection
Returns a new instance of DesignCollection.
30 31 32 33 34 35 36 37 38 |
# File 'app/models/design_management/design_collection.rb', line 30 def initialize(issue) super() # Necessary to initialize state_machine @issue = issue if stored_copy_state = get_stored_copy_state @copy_state = stored_copy_state end end |
Instance Attribute Details
#issue ⇒ Object (readonly)
Returns the value of attribute issue.
5 6 7 |
# File 'app/models/design_management/design_collection.rb', line 5 def issue @issue end |
Instance Method Details
#==(other) ⇒ Object
40 41 42 |
# File 'app/models/design_management/design_collection.rb', line 40 def ==(other) other.is_a?(self.class) && issue == other.issue end |
#designs_by_filename(filenames) ⇒ Object
57 58 59 |
# File 'app/models/design_management/design_collection.rb', line 57 def designs_by_filename(filenames) designs.current.where(filename: filenames) end |
#find_or_create_design!(filename:) ⇒ Object
44 45 46 47 |
# File 'app/models/design_management/design_collection.rb', line 44 def find_or_create_design!(filename:) designs.find { |design| design.filename == filename } || designs.safe_find_or_create_by!(project: project, filename: filename) end |
#repository ⇒ Object
53 54 55 |
# File 'app/models/design_management/design_collection.rb', line 53 def repository project.design_repository end |
#versions ⇒ Object
49 50 51 |
# File 'app/models/design_management/design_collection.rb', line 49 def versions @versions ||= DesignManagement::Version.for_designs(designs) end |