Class: GitObjectBrowser::Models::IndexEntry

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Bindata

#binstr, #byte, #bytes, #find_char, #hex, #int, #peek, #raw, #seek, #skip, #switch_source

Constructor Details

#initialize(input, version, last_path = nil) ⇒ IndexEntry

Returns a new instance of IndexEntry.



14
15
16
17
18
19
# File 'lib/git-object-browser/models/index_entry.rb', line 14

def initialize(input, version, last_path = nil)
  super(input)
  @version = version
  @last_path = last_path
  parse
end

Instance Attribute Details

#assume_valid_flagObject (readonly)

Returns the value of attribute assume_valid_flag.



10
11
12
# File 'lib/git-object-browser/models/index_entry.rb', line 10

def assume_valid_flag
  @assume_valid_flag
end

#cnanoObject (readonly)

Returns the value of attribute cnano.



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

def cnano
  @cnano
end

#ctimeObject (readonly)

Returns the value of attribute ctime.



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

def ctime
  @ctime
end

#devObject (readonly)

Returns the value of attribute dev.



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

def dev
  @dev
end

#extended_flagObject (readonly)

Returns the value of attribute extended_flag.



10
11
12
# File 'lib/git-object-browser/models/index_entry.rb', line 10

def extended_flag
  @extended_flag
end

#gidObject (readonly)

Returns the value of attribute gid.



9
10
11
# File 'lib/git-object-browser/models/index_entry.rb', line 9

def gid
  @gid
end

#inoObject (readonly)

Returns the value of attribute ino.



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

def ino
  @ino
end

#intent_to_addObject (readonly)

Returns the value of attribute intent_to_add.



11
12
13
# File 'lib/git-object-browser/models/index_entry.rb', line 11

def intent_to_add
  @intent_to_add
end

#mnanoObject (readonly)

Returns the value of attribute mnano.



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

def mnano
  @mnano
end

#mtimeObject (readonly)

Returns the value of attribute mtime.



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

def mtime
  @mtime
end

#name_lengthObject (readonly)

Returns the value of attribute name_length.



12
13
14
# File 'lib/git-object-browser/models/index_entry.rb', line 12

def name_length
  @name_length
end

#object_typeObject (readonly)

Returns the value of attribute object_type.



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

def object_type
  @object_type
end

#pathObject (readonly)

Returns the value of attribute path.



9
10
11
# File 'lib/git-object-browser/models/index_entry.rb', line 9

def path
  @path
end

#sha1Object (readonly)

Returns the value of attribute sha1.



9
10
11
# File 'lib/git-object-browser/models/index_entry.rb', line 9

def sha1
  @sha1
end

#sizeObject (readonly)

Returns the value of attribute size.



9
10
11
# File 'lib/git-object-browser/models/index_entry.rb', line 9

def size
  @size
end

#skip_worktreeObject (readonly)

Returns the value of attribute skip_worktree.



11
12
13
# File 'lib/git-object-browser/models/index_entry.rb', line 11

def skip_worktree
  @skip_worktree
end

#stageObject (readonly)

Returns the value of attribute stage.



10
11
12
# File 'lib/git-object-browser/models/index_entry.rb', line 10

def stage
  @stage
end

#uidObject (readonly)

Returns the value of attribute uid.



9
10
11
# File 'lib/git-object-browser/models/index_entry.rb', line 9

def uid
  @uid
end

#unix_permissionObject (readonly)

Returns the value of attribute unix_permission.



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

def unix_permission
  @unix_permission
end

#versionObject (readonly)

Returns the value of attribute version.



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

def version
  @version
end

Instance Method Details

#parseObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/git-object-browser/models/index_entry.rb', line 21

def parse
  @ctime = int       # 4
  @cnano = int       # 8
  @mtime = int       # 12
  @mnano = int       # 16
  @dev   = int       # 20
  @ino   = int       # 24
  parse_mode         # 28
  @uid   = int       # 32
  @gid   = int       # 36
  @size  = int       # 40
  @sha1  = hex(20)   # 60
  parse_flags        # 62 (+2)
  parse_path
end

#to_hashObject



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/git-object-browser/models/index_entry.rb', line 103

def to_hash
  return {
    :ctime  => @ctime,
    :cnano  => @cnano,
    :mtime  => @mtime,
    :mnano  => @mnano,
    :dev    => @dev,
    :ino    => @ino,
    :object_type        => @object_type,
    :unix_permission    => @unix_permission,

    :uid    => @uid,
    :gid    => @gid,
    :size   => @size,
    :sha1   => @sha1,
    :path   => @path,

    :assume_valid_flag  => @assume_valid_flag,
    :extended_flag      => @extended_flag,
    :stage              => @stage,
    :skip_worktree      => @skip_worktree,
    :intent_to_add      => @intent_to_add,
    :name_length        => @name_length,
  }
end