Class: Zip::FileSystem::ZipFsFile::ZipFsStat

Inherits:
Object
  • Object
show all
Defined in:
lib/zip/filesystem.rb

Overview

protected :dir

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(zipFsFile, entryName) ⇒ ZipFsStat

Returns a new instance of ZipFsStat.


88
89
90
91
# File 'lib/zip/filesystem.rb', line 88

def initialize(zipFsFile, entryName)
  @zipFsFile = zipFsFile
  @entryName = entryName
end

Class Method Details

.delegate_to_fs_file(*methods) ⇒ Object


76
77
78
79
80
81
82
83
84
# File 'lib/zip/filesystem.rb', line 76

def delegate_to_fs_file(*methods)
  methods.each do |method|
    self.class_eval <<-end_eval, __FILE__, __LINE__ + 1
      def #{method}                      # def file?
        @zipFsFile.#{method}(@entryName) #   @zipFsFile.file?(@entryName)
      end                                # end
    end_eval
  end
end

Instance Method Details

#blksizeObject


149
# File 'lib/zip/filesystem.rb', line 149

def blksize; nil; end

#blocksObject


102
# File 'lib/zip/filesystem.rb', line 102

def blocks; nil; end

#devObject


129
# File 'lib/zip/filesystem.rb', line 129

def dev; 0; end

#ftypeObject


137
138
139
140
141
142
143
144
145
# File 'lib/zip/filesystem.rb', line 137

def ftype
  if file?
    return "file"
  elsif directory?
    return "directory"
  else
    raise StandardError, "Unknown file type"
  end
end

#gidObject


109
110
111
112
113
114
115
116
# File 'lib/zip/filesystem.rb', line 109

def gid
  e = get_entry
  if e.extra.member? "IUnix"
    e.extra["IUnix"].gid || 0
  else
    0
  end
end

#inoObject


127
# File 'lib/zip/filesystem.rb', line 127

def ino; 0; end

#kind_of?(t) ⇒ Boolean

Returns:

  • (Boolean)

93
94
95
# File 'lib/zip/filesystem.rb', line 93

def kind_of?(t)
  super || t == ::File::Stat 
end

#modeObject


151
152
153
154
155
156
157
158
# File 'lib/zip/filesystem.rb', line 151

def mode
  e = get_entry
  if e.fstype == 3
    e.external_file_attributes >> 16
  else
    33206 # 33206 is equivalent to -rw-rw-rw-
  end
end

147
# File 'lib/zip/filesystem.rb', line 147

def nlink; 1; end

#rdevObject


131
# File 'lib/zip/filesystem.rb', line 131

def rdev; 0; end

#rdev_majorObject


133
# File 'lib/zip/filesystem.rb', line 133

def rdev_major; 0; end

#rdev_minorObject


135
# File 'lib/zip/filesystem.rb', line 135

def rdev_minor; 0; end

#uidObject


118
119
120
121
122
123
124
125
# File 'lib/zip/filesystem.rb', line 118

def uid
  e = get_entry
  if e.extra.member? "IUnix"
    e.extra["IUnix"].uid || 0
  else
    0
  end
end