Class: Zip::FileSystem::File::Stat
- Inherits:
-
Object
- Object
- Zip::FileSystem::File::Stat
- Defined in:
- lib/zip/filesystem/file_stat.rb
Overview
:nodoc:all
Class Method Summary collapse
Instance Method Summary collapse
- #blksize ⇒ Object
- #blocks ⇒ Object
- #dev ⇒ Object
- #ftype ⇒ Object
- #gid ⇒ Object
-
#initialize(zip_fs_file, entry_name) ⇒ Stat
constructor
A new instance of Stat.
- #ino ⇒ Object
- #kind_of?(type) ⇒ Boolean
- #mode ⇒ Object
- #nlink ⇒ Object
- #rdev ⇒ Object
- #rdev_major ⇒ Object
- #rdev_minor ⇒ Object
- #uid ⇒ Object
Constructor Details
#initialize(zip_fs_file, entry_name) ⇒ Stat
Returns a new instance of Stat.
19 20 21 22 |
# File 'lib/zip/filesystem/file_stat.rb', line 19 def initialize(zip_fs_file, entry_name) @zip_fs_file = zip_fs_file @entry_name = entry_name end |
Class Method Details
.delegate_to_fs_file(*methods) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/zip/filesystem/file_stat.rb', line 8 def delegate_to_fs_file(*methods) methods.each do |method| class_exec do define_method(method) do @zip_fs_file.__send__(method, @entry_name) end end end end |
Instance Method Details
#blksize ⇒ Object
89 90 91 |
# File 'lib/zip/filesystem/file_stat.rb', line 89 def blksize nil end |
#blocks ⇒ Object
33 34 35 |
# File 'lib/zip/filesystem/file_stat.rb', line 33 def blocks nil end |
#dev ⇒ Object
59 60 61 |
# File 'lib/zip/filesystem/file_stat.rb', line 59 def dev 0 end |
#ftype ⇒ Object
75 76 77 78 79 80 81 82 83 |
# File 'lib/zip/filesystem/file_stat.rb', line 75 def ftype if file? 'file' elsif directory? 'directory' else raise StandardError, 'Unknown file type' end end |
#gid ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/zip/filesystem/file_stat.rb', line 37 def gid e = find_entry if e.extra.member? 'IUnix' e.extra['IUnix'].gid || 0 else 0 end end |
#ino ⇒ Object
55 56 57 |
# File 'lib/zip/filesystem/file_stat.rb', line 55 def ino 0 end |
#kind_of?(type) ⇒ Boolean
24 25 26 |
# File 'lib/zip/filesystem/file_stat.rb', line 24 def kind_of?(type) super || type == ::File::Stat end |
#mode ⇒ Object
93 94 95 96 97 98 99 100 |
# File 'lib/zip/filesystem/file_stat.rb', line 93 def mode e = find_entry if e.fstype == FSTYPE_UNIX e.external_file_attributes >> 16 else 0o100_666 # Equivalent to -rw-rw-rw-. end end |
#nlink ⇒ Object
85 86 87 |
# File 'lib/zip/filesystem/file_stat.rb', line 85 def nlink 1 end |
#rdev ⇒ Object
63 64 65 |
# File 'lib/zip/filesystem/file_stat.rb', line 63 def rdev 0 end |
#rdev_major ⇒ Object
67 68 69 |
# File 'lib/zip/filesystem/file_stat.rb', line 67 def rdev_major 0 end |
#rdev_minor ⇒ Object
71 72 73 |
# File 'lib/zip/filesystem/file_stat.rb', line 71 def rdev_minor 0 end |
#uid ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/zip/filesystem/file_stat.rb', line 46 def uid e = find_entry if e.extra.member? 'IUnix' e.extra['IUnix'].uid || 0 else 0 end end |