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, 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)

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)


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

def anti?
  return @anti
end

#directory?Boolean

Returns:

  • (Boolean)


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

def directory?
  return @dir
end

#encrypted?Boolean

Returns:

  • (Boolean)


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

def encrypted?
  return @encrypted
end

#file?Boolean

Returns:

  • (Boolean)


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

def file?
  return !(@dir)
end

#has_data?Boolean

Returns:

  • (Boolean)


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

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

#inspectObject



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

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