Class: Senju::Track

Inherits:
Object
  • Object
show all
Defined in:
lib/senju/track.rb

Constant Summary collapse

PATH =
Dir.home + '/.senju/tracks'

Class Method Summary collapse

Class Method Details

.add(project, issue_no) ⇒ Object



21
22
23
24
25
26
# File 'lib/senju/track.rb', line 21

def self.add(project, issue_no)
  load
  @data[project] = {} unless @data[project]
  @data[project][issue_no.to_i] = nil
  save
end

.allObject



17
18
19
# File 'lib/senju/track.rb', line 17

def self.all
  self.load
end

.loadObject



5
6
7
8
9
10
11
# File 'lib/senju/track.rb', line 5

def self.load
  if File.exist? PATH
    @data = YAML.load_file(PATH)
  else
    @data = {}
  end
end

.saveObject



13
14
15
# File 'lib/senju/track.rb', line 13

def self.save
  YAML.dump(@data, File.open(PATH, 'w'))
end