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.



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

#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



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

#repositoryObject



53
54
55
# File 'app/models/design_management/design_collection.rb', line 53

def repository
  project.design_repository
end

#versionsObject



49
50
51
# File 'app/models/design_management/design_collection.rb', line 49

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