Class: GitHubEventWatcher::PersistentState

Inherits:
Object
  • Object
show all
Defined in:
lib/github-event-watcher/persistent-state.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ PersistentState

Returns a new instance of PersistentState.



20
21
22
23
# File 'lib/github-event-watcher/persistent-state.rb', line 20

def initialize(path)
  @path = path
  load
end

Instance Method Details

#processed_event_id(repository_name) ⇒ Object



25
26
27
# File 'lib/github-event-watcher/persistent-state.rb', line 25

def processed_event_id(repository_name)
  repository(repository_name)["processed-event-id"] || 0
end

#update_processed_event_id(repository_name, id) ⇒ Object



29
30
31
32
# File 'lib/github-event-watcher/persistent-state.rb', line 29

def update_processed_event_id(repository_name, id)
  repository(repository_name)["processed-event-id"] = id
  save
end