Class: Grit::Ref
- Inherits:
-
Object
- Object
- Grit::Ref
- Defined in:
- lib/grit/ref.rb
Instance Attribute Summary collapse
-
#commit ⇒ Object
readonly
Returns the value of attribute commit.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
-
.find_all(repo, options = {}) ⇒ Object
Find all Refs
repo
is the Repooptions
is a Hash of options.
Instance Method Summary collapse
-
#initialize(name, commit) ⇒ 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, commit) ⇒ 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)
37 38 39 40 |
# File 'lib/grit/ref.rb', line 37 def initialize(name, commit) @name = name @commit = commit end |
Instance Attribute Details
#commit ⇒ Object (readonly)
Returns the value of attribute commit.
30 31 32 |
# File 'lib/grit/ref.rb', line 30 def commit @commit end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
29 30 31 |
# File 'lib/grit/ref.rb', line 29 def name @name end |
Class Method Details
.find_all(repo, options = {}) ⇒ Object
Find all Refs
+repo+ is the Repo
+options+ is a Hash of options
Returns Grit::Ref[] (baked)
12 13 14 15 16 17 18 19 |
# File 'lib/grit/ref.rb', line 12 def find_all(repo, = {}) refs = repo.git.refs(, prefix) refs.split("\n").map do |ref| name, id = *ref.split(' ') commit = Commit.create(repo, :id => id) self.new(name, commit) end end |
Instance Method Details
#inspect ⇒ Object
Pretty object inspection
43 44 45 |
# File 'lib/grit/ref.rb', line 43 def inspect %Q{#<#{self.class.name} "#{@name}">} end |