Class: GitObjectBrowser::Models::InfoRefs

Inherits:
Object
  • Object
show all
Defined in:
lib/git-object-browser/models/info_refs.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input) ⇒ 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_hashObject



19
20
21
22
23
# File 'lib/git-object-browser/models/info_refs.rb', line 19

def to_hash
  return {
    :entries => @entries
  }
end