Class: ArtisanMemoryRepository::ProjectRepository
- Inherits:
-
Object
- Object
- ArtisanMemoryRepository::ProjectRepository
show all
- Includes:
- BaseRepository
- Defined in:
- lib/artisan-memory-repository/project_repository.rb
Instance Method Summary
collapse
#create, #delete, #destroy_all, #find, #find_each, #records, #save, #where
Instance Method Details
#add_iteration(project, iteration) ⇒ Object
37
38
39
40
41
|
# File 'lib/artisan-memory-repository/project_repository.rb', line 37
def add_iteration(project, iteration)
project.iterations << iteration
project.iterations.sort! { |i| i.number }
iteration
end
|
#add_member(project, user, owner) ⇒ Object
43
44
45
46
|
# File 'lib/artisan-memory-repository/project_repository.rb', line 43
def add_member(project, user, owner)
project.users << user
project.owners << user if owner
end
|
#archived ⇒ Object
25
26
27
|
# File 'lib/artisan-memory-repository/project_repository.rb', line 25
def archived
records.values.select { |r| r.archived }.sort_by(&:name)
end
|
#create_project_configuration(project) ⇒ Object
#find_by_api_key(api_key) ⇒ Object
29
30
31
|
# File 'lib/artisan-memory-repository/project_repository.rb', line 29
def find_by_api_key(api_key)
records.values.find { |r| r.api_key == api_key }
end
|
#find_by_name(name) ⇒ Object
33
34
35
|
# File 'lib/artisan-memory-repository/project_repository.rb', line 33
def find_by_name(name)
records.values.find{|r| r.name == name}
end
|
#is_member?(project, user) ⇒ Boolean
53
54
55
|
# File 'lib/artisan-memory-repository/project_repository.rb', line 53
def is_member?(project, user)
project.users.include?(user)
end
|
#is_owner?(project, user) ⇒ Boolean
57
58
59
|
# File 'lib/artisan-memory-repository/project_repository.rb', line 57
def is_owner?(project, user)
project.owners.include?(user)
end
|
#new(attributes = {}) ⇒ Object
13
14
15
|
# File 'lib/artisan-memory-repository/project_repository.rb', line 13
def new(attributes = {})
model_class.new(attributes)
end
|
#order_by_name ⇒ Object
17
18
19
|
# File 'lib/artisan-memory-repository/project_repository.rb', line 17
def order_by_name
records.values.sort_by { |r| r.name }
end
|
#owners(project) ⇒ Object
61
62
63
|
# File 'lib/artisan-memory-repository/project_repository.rb', line 61
def owners(project)
project.owners
end
|
#remove_member(project, user) ⇒ Object
48
49
50
51
|
# File 'lib/artisan-memory-repository/project_repository.rb', line 48
def remove_member(project, user)
project.users.delete(user)
project.owners.delete(user)
end
|
#unarchived ⇒ Object
21
22
23
|
# File 'lib/artisan-memory-repository/project_repository.rb', line 21
def unarchived
records.values.select { |r| !r.archived }.sort_by(&:name)
end
|