Class: Grit::Ref
- Inherits:
-
Object
- Object
- Grit::Ref
- Defined in:
- lib/grit/ref.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
-
.count_all(repo, options = {}) ⇒ Object
Count all Refs
repo
is the Repooptions
is a Hash of options. -
.find_all(repo, options = {}) ⇒ Object
Find all Refs
repo
is the Repooptions
is a Hash of options.
Instance Method Summary collapse
- #commit ⇒ Object
-
#initialize(name, repo, commit_id) ⇒ Ref
constructor
Instantiate a new Head
name
is the name of the headcommit
is the Commit that the head points to. -
#inspect ⇒ Object
Pretty object inspection.
Constructor Details
#initialize(name, repo, commit_id) ⇒ Ref
Instantiate a new Head
+name+ is the name of the head
+commit+ is the Commit that the head points to
Returns Grit::Head (baked)
45 46 47 48 49 50 |
# 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 |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
38 39 40 |
# File 'lib/grit/ref.rb', line 38 def name @name end |
Class Method Details
.count_all(repo, options = {}) ⇒ Object
Count all Refs
+repo+ is the Repo
+options+ is a Hash of options
Returns int
12 13 14 15 |
# File 'lib/grit/ref.rb', line 12 def count_all(repo, = {}) refs = repo.git.refs(, prefix) refs.split("\n").size end |
.find_all(repo, options = {}) ⇒ Object
Find all Refs
+repo+ is the Repo
+options+ is a Hash of options
Returns Grit::Ref[] (baked)
22 23 24 25 26 27 28 |
# File 'lib/grit/ref.rb', line 22 def find_all(repo, = {}) refs = repo.git.refs(, prefix) refs.split("\n").map do |ref| name, id = *ref.split(' ') self.new(name, repo, id) end end |
Instance Method Details
#commit ⇒ Object
52 53 54 |
# File 'lib/grit/ref.rb', line 52 def commit @commit ||= get_commit end |
#inspect ⇒ Object
Pretty object inspection
57 58 59 |
# File 'lib/grit/ref.rb', line 57 def inspect %Q{#<#{self.class.name} "#{@name}">} end |