Class: Octopi::Branch

Inherits:
Base
  • Object
show all
Includes:
Resource
Defined in:
lib/octopi/branch.rb

Constant Summary

Constant Summary

Constants inherited from Base

Octopi::Base::VALID

Instance Attribute Summary (collapse)

Attributes inherited from Base

#api

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods included from Resource

for, included

Methods inherited from Base

#error=, #property, #save

Constructor Details

- (Branch) initialize(*args)

Called when we ask for a resource. Arguments are passed in like [<name>, <sha>] TODO: Find out why args are doubly nested



12
13
14
15
16
# File 'lib/octopi/branch.rb', line 12

def initialize(*args)
  args = args.flatten!
  self.name = args.first
  self.sha = args.last
end

Instance Attribute Details

- (Object) name

Returns the value of attribute name



3
4
5
# File 'lib/octopi/branch.rb', line 3

def name
  @name
end

- (Object) sha

Returns the value of attribute sha



3
4
5
# File 'lib/octopi/branch.rb', line 3

def sha
  @sha
end

Class Method Details

+ (Object) all(options = {})



22
23
24
25
26
27
28
29
# File 'lib/octopi/branch.rb', line 22

def self.all(options={})
  ensure_hash(options)
  user, repo = gather_details(options)
  self.validate_args(user => :user, repo => :repo)
  BranchSet.new(find_plural([user, repo, 'branches'], :resource)) do |i|
    { :name => i.first, :hash => i.last }
  end
end

Instance Method Details

- (Object) to_s



18
19
20
# File 'lib/octopi/branch.rb', line 18

def to_s
  name
end