class Grit::Ref
Attributes
name[R]
Public Class Methods
count_all(repo, options = {})
click to toggle source
Count all Refs
+repo+ is the Repo +options+ is a Hash of options
Returns int
# File lib/grit/ref.rb, line 12 def count_all(repo, options = {}) refs = repo.git.refs(options, prefix) refs.split("\n").size end
find_all(repo, options = {})
click to toggle source
Find all Refs
+repo+ is the Repo +options+ is a Hash of options
Returns Grit::Ref[] (baked)
# File lib/grit/ref.rb, line 22 def find_all(repo, options = {}) refs = repo.git.refs(options, prefix) refs.split("\n").map do |ref| name, id = *ref.split(' ') self.new(name, repo, id) end end
new(name, repo, commit_id)
click to toggle source
Instantiate a new Head
+name+ is the name of the head +commit+ is the Commit that the head points to
Returns Grit::Head (baked)
# File lib/grit/ref.rb, line 45 def initialize(name, repo, commit_id) @name = name @commit_id = commit_id @repo_ref = repo @commit = nil end
Protected Class Methods
prefix()
click to toggle source
# File lib/grit/ref.rb, line 32 def prefix "refs/#{name.to_s.gsub(/^.*::/, '').downcase}s" end
Public Instance Methods
commit()
click to toggle source
# File lib/grit/ref.rb, line 52 def commit @commit ||= get_commit end
inspect()
click to toggle source
Pretty object inspection
# File lib/grit/ref.rb, line 57 def inspect %Q{#<#{self.class.name} "#{@name}">} end
Protected Instance Methods
get_commit()
click to toggle source
# File lib/grit/ref.rb, line 63 def get_commit Commit.create(@repo_ref, :id => @commit_id) end