Class: ArtisanMemoryRepository::ChangeRepository

Inherits:
Object
  • Object
show all
Includes:
BaseRepository
Defined in:
lib/artisan-memory-repository/change_repository.rb

Instance Method Summary collapse

Methods included from BaseRepository

#create, #delete, #destroy_all, #find, #find_each, #records, #save, #where

Instance Method Details

#create_iteration_change(attributes = {}) ⇒ Object



16
17
18
# File 'lib/artisan-memory-repository/change_repository.rb', line 16

def create_iteration_change(attributes = {})
  create(attributes.merge({:type => "IterationChange"}))
end

#create_project_change(attributes = {}) ⇒ Object



12
13
14
# File 'lib/artisan-memory-repository/change_repository.rb', line 12

def create_project_change(attributes = {})
  create(attributes.merge({:type => "ProjectChange"}))
end

#create_story_change(attributes = {}) ⇒ Object



20
21
22
# File 'lib/artisan-memory-repository/change_repository.rb', line 20

def create_story_change(attributes = {})
  create(attributes.merge({:type => "StoryChange"}))
end

#find_all_by_project_id(project_id) ⇒ Object



24
25
26
# File 'lib/artisan-memory-repository/change_repository.rb', line 24

def find_all_by_project_id(project_id)
  records.values.find_all {|r| r.project_id == project_id}.sort_by(&:created_at).reverse
end

#find_range_by_project_id(project_id, starts_at, ends_at) ⇒ Object



28
29
30
# File 'lib/artisan-memory-repository/change_repository.rb', line 28

def find_range_by_project_id(project_id, starts_at, ends_at)
  find_all_by_project_id(project_id)[starts_at..ends_at]
end

#model_classObject



8
9
10
# File 'lib/artisan-memory-repository/change_repository.rb', line 8

def model_class
  ArtisanMemoryRepository::Change
end