This commit is contained in:
Rikuoh Tsujitani 2024-05-22 12:52:57 +09:00
parent b6220c85c4
commit 93b13c84c5

25
ls.rb
View file

@ -83,22 +83,15 @@ def permission(file_stat)
end end
def file_type(file_stat) def file_type(file_stat)
case file_stat.ftype {
when 'file' 'fifo' => 'p',
print '-' 'characterSpecial' => 'c',
when 'directory' 'directory' => 'd',
print 'd' 'blockSpecial' => 'b',
when 'characterSpecial' 'file' => '-',
print 'c' 'link' => 'l',
when 'blockSpecial' 'socket' => 's'
print 'b' }[file_stat]
when 'fifo'
print 'p'
when 'link'
print 'l'
when 'socket'
print 's'
end
end end
def file_size(filenames) def file_size(filenames)