Module: GitFeats::History

Extended by:
History
Included in:
History
Defined in:
lib/git-feats/history.rb

Constant Summary collapse

PATH =
Dir.home + '/.git_feats/history'

Instance Method Summary collapse

Instance Method Details

#add(pattern) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/git-feats/history.rb', line 18

def add(pattern)
  if @history[pattern]
    @history[pattern] += 1
  else
    @history[pattern] = 1
  end
end

#count(pattern) ⇒ Object



26
27
28
# File 'lib/git-feats/history.rb', line 26

def count(pattern)
  @history[pattern]
end

#dataObject



30
31
32
# File 'lib/git-feats/history.rb', line 30

def data
  @history
end

#serializeObject

write data to file



14
15
16
# File 'lib/git-feats/history.rb', line 14

def serialize
  Serializer.serialize(PATH, @history)
end

#unserializeObject

load data from file



9
10
11
# File 'lib/git-feats/history.rb', line 9

def unserialize
  @history = Serializer.unserialize(PATH) || {}
end