Class: GitObjectBrowser::Models::Reflog

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input) ⇒ Reflog

Returns a new instance of Reflog.



7
8
9
# File 'lib/git-object-browser/models/reflog.rb', line 7

def initialize(input)
  @in = input
end

Class Method Details

.path?(relpath) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/git-object-browser/models/reflog.rb', line 48

def self.path?(relpath)
  return relpath =~ %r{\Alogs/.+}
end

Instance Method Details

#parseObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/git-object-browser/models/reflog.rb', line 11

def parse
  @entries = []
  @content = @in.read(nil)
  @content = @content.force_encoding('UTF-8')
  unless @content.valid_encoding?
    @content = '(not UTF-8)'
    return self
  end
  parse_logs
  self
end

#to_hashObject



44
45
46
# File 'lib/git-object-browser/models/reflog.rb', line 44

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