diff --git a/ls.rb b/ls.rb index 31432e7..d2e56a7 100644 --- a/ls.rb +++ b/ls.rb @@ -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)