Class: GitObjectBrowser::Models::InfoRefs
- Inherits:
-
Object
- Object
- GitObjectBrowser::Models::InfoRefs
- Defined in:
- lib/git-object-browser/models/info_refs.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(input) ⇒ InfoRefs
constructor
A new instance of InfoRefs.
- #to_hash ⇒ Object
Constructor Details
#initialize(input) ⇒ InfoRefs
Returns a new instance of InfoRefs.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/git-object-browser/models/info_refs.rb', line 7 def initialize(input) @entries = [] while (line = input.gets) do next if line =~ /\A\s*#/ next unless line =~ /([0-9a-f]{40})\s*(.*)/ entry = {} entry[:sha1] = $1 entry[:ref] = $2 @entries << entry end end |
Class Method Details
.path?(relpath) ⇒ Boolean
25 26 27 |
# File 'lib/git-object-browser/models/info_refs.rb', line 25 def self.path?(relpath) return relpath == "info/refs" end |
Instance Method Details
#to_hash ⇒ Object
19 20 21 22 23 |
# File 'lib/git-object-browser/models/info_refs.rb', line 19 def to_hash return { :entries => @entries } end |