Class: Github::BranchCache
Instance Method Summary collapse
- #create(name, sha) ⇒ Object
- #delete(name) ⇒ Object
-
#initialize(repo) ⇒ BranchCache
constructor
A new instance of BranchCache.
- #read(name) ⇒ Object
- #update(name, sha) ⇒ Object
Constructor Details
#initialize(repo) ⇒ BranchCache
Returns a new instance of BranchCache.
70 71 72 73 |
# File 'lib/github.rb', line 70 def initialize(repo) @repo = repo @cache = {} end |
Instance Method Details
#create(name, sha) ⇒ Object
75 76 77 |
# File 'lib/github.rb', line 75 def create(name, sha) @cache[name] = client.create_ref(@repo, "heads/#{name}", sha) end |
#delete(name) ⇒ Object
87 88 89 90 91 |
# File 'lib/github.rb', line 87 def delete(name) ref = client.delete_ref(@repo, "heads/#{name}") @cache.delete(name) ref end |
#read(name) ⇒ Object
79 80 81 |
# File 'lib/github.rb', line 79 def read(name) @cache[name] = client.ref(@repo, "heads/#{name}") end |
#update(name, sha) ⇒ Object
83 84 85 |
# File 'lib/github.rb', line 83 def update(name, sha) @cache[name] = client.update_branch(@repo, name, sha) end |