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
def file_type(file_stat)
case file_stat.ftype
when 'file'
print '-'
when 'directory'
print 'd'
when 'characterSpecial'
print 'c'
when 'blockSpecial'
print 'b'
when 'fifo'
print 'p'
when 'link'
print 'l'
when 'socket'
print 's'
end
{
'fifo' => 'p',
'characterSpecial' => 'c',
'directory' => 'd',
'blockSpecial' => 'b',
'file' => '-',
'link' => 'l',
'socket' => 's'
}[file_stat]
end
def file_size(filenames)