Class: DesignManagement::DesignCollection

Inherits:
Object
  • Object
show all
Defined in:
app/models/design_management/design_collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(issue) ⇒ DesignCollection

Returns a new instance of DesignCollection.


9
10
11
# File 'app/models/design_management/design_collection.rb', line 9

def initialize(issue)
  @issue = issue
end

Instance Attribute Details

#issueObject (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


13
14
15
# File 'app/models/design_management/design_collection.rb', line 13

def ==(other)
  other.is_a?(self.class) && issue == other.issue
end

#designs_by_filename(filenames) ⇒ Object


30
31
32
# File 'app/models/design_management/design_collection.rb', line 30

def designs_by_filename(filenames)
  designs.current.where(filename: filenames)
end

#find_or_create_design!(filename:) ⇒ Object


17
18
19
20
# File 'app/models/design_management/design_collection.rb', line 17

def find_or_create_design!(filename:)
  designs.find { |design| design.filename == filename } ||
    designs.safe_find_or_create_by!(project: project, filename: filename)
end

#repositoryObject


26
27
28
# File 'app/models/design_management/design_collection.rb', line 26

def repository
  project.design_repository
end

#versionsObject


22
23
24
# File 'app/models/design_management/design_collection.rb', line 22

def versions
  @versions ||= DesignManagement::Version.for_designs(designs)
end