Class: SevenZipRuby::EntryInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/seven_zip_ruby/entry_info.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(index, path, method, dir, encrypted, anti, size, pack_size, ctime, atime, mtime, attrib, crc) ⇒ EntryInfo

Returns a new instance of EntryInfo.



5
6
7
8
# File 'lib/seven_zip_ruby/entry_info.rb', line 5

def initialize(index, path, method, dir, encrypted, anti, size, pack_size, ctime, atime, mtime, attrib, crc)
  @index, @path, @method, @dir, @encrypted, @anti, @size, @pack_size, @ctime, @atime, @mtime, @attrib, @crc =
    index, Pathname(path.to_s.force_encoding(Encoding::UTF_8)).cleanpath.to_s, method, dir, encrypted, anti, size, pack_size, ctime, atime, mtime, attrib, crc
end

Instance Attribute Details

#atimeObject (readonly)

Returns the value of attribute atime.



10
11
12
# File 'lib/seven_zip_ruby/entry_info.rb', line 10

def atime
  @atime
end

#attribObject (readonly)

Returns the value of attribute attrib.



10
11
12
# File 'lib/seven_zip_ruby/entry_info.rb', line 10

def attrib
  @attrib
end

#crcObject (readonly) Also known as: crc32

Returns the value of attribute crc.



10
11
12
# File 'lib/seven_zip_ruby/entry_info.rb', line 10

def crc
  @crc
end

#ctimeObject (readonly)

Returns the value of attribute ctime.



10
11
12
# File 'lib/seven_zip_ruby/entry_info.rb', line 10

def ctime
  @ctime
end

#indexObject (readonly) Also known as: to_i

Returns the value of attribute index.



10
11
12
# File 'lib/seven_zip_ruby/entry_info.rb', line 10

def index
  @index
end

#methodObject (readonly)

Returns the value of attribute method.



10
11
12
# File 'lib/seven_zip_ruby/entry_info.rb', line 10

def method
  @method
end

#mtimeObject (readonly)

Returns the value of attribute mtime.



10
11
12
# File 'lib/seven_zip_ruby/entry_info.rb', line 10

def mtime
  @mtime
end

#pack_sizeObject (readonly)

Returns the value of attribute pack_size.



10
11
12
# File 'lib/seven_zip_ruby/entry_info.rb', line 10

def pack_size
  @pack_size
end

#pathObject (readonly)

Returns the value of attribute path.



10
11
12
# File 'lib/seven_zip_ruby/entry_info.rb', line 10

def path
  @path
end

#sizeObject (readonly)

Returns the value of attribute size.



10
11
12
# File 'lib/seven_zip_ruby/entry_info.rb', line 10

def size
  @size
end

Instance Method Details

#anti?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/seven_zip_ruby/entry_info.rb', line 26

def anti?
  return @anti
end

#directory?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/seven_zip_ruby/entry_info.rb', line 14

def directory?
  return @dir
end

#encrypted?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/seven_zip_ruby/entry_info.rb', line 22

def encrypted?
  return @encrypted
end

#file?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/seven_zip_ruby/entry_info.rb', line 18

def file?
  return !(@dir)
end

#has_data?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/seven_zip_ruby/entry_info.rb', line 30

def has_data?
  return !(@dir || @anti)
end

#inspectObject



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/seven_zip_ruby/entry_info.rb', line 34

def inspect
  if (@anti)
    type = "anti"
  elsif (@dir)
    type = "dir"
  else
    type = "file"
  end
  str = path.encode(Encoding::ASCII, invalid: :replace, undef: :replace, replace: "?")
  return "#<EntryInfo: #{index}, #{type}, #{str}>"
end