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.


82
83
84
85
# File 'lib/zip/filesystem.rb', line 82

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

Class Method Details

.delegate_to_fs_file(*methods) ⇒ Object


71
72
73
74
75
76
77
78
79
# File 'lib/zip/filesystem.rb', line 71

def delegate_to_fs_file(*methods)
  methods.each do |method|
    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


157
158
159
# File 'lib/zip/filesystem.rb', line 157

def blksize
  nil
end

#blocksObject


96
97
98
# File 'lib/zip/filesystem.rb', line 96

def blocks
  nil
end

#devObject


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

def dev
  0
end

#ftypeObject


143
144
145
146
147
148
149
150
151
# File 'lib/zip/filesystem.rb', line 143

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

#gidObject


105
106
107
108
109
110
111
112
# File 'lib/zip/filesystem.rb', line 105

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

#inoObject


123
124
125
# File 'lib/zip/filesystem.rb', line 123

def ino
  0
end

#kind_of?(t) ⇒ Boolean

Returns:

  • (Boolean)

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

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

#modeObject


161
162
163
164
165
166
167
168
# File 'lib/zip/filesystem.rb', line 161

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

153
154
155
# File 'lib/zip/filesystem.rb', line 153

def nlink
  1
end

#rdevObject


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

def rdev
  0
end

#rdev_majorObject


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

def rdev_major
  0
end

#rdev_minorObject


139
140
141
# File 'lib/zip/filesystem.rb', line 139

def rdev_minor
  0
end

#uidObject


114
115
116
117
118
119
120
121
# File 'lib/zip/filesystem.rb', line 114

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