class Ru::File
Public Class Methods
new(path)
click to toggle source
# File lib/ru/file.rb, line 5 def initialize(path) @path = path end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/ru/file.rb, line 76 def <=>(other) name <=> other.name end
basename()
click to toggle source
# File lib/ru/file.rb, line 9 def basename delegate_to_file(:basename) end
Also aliased as: name
ctime()
click to toggle source
# File lib/ru/file.rb, line 13 def ctime delegate_to_file(:ctime) end
Also aliased as: created_at
extname()
click to toggle source
# File lib/ru/file.rb, line 17 def extname delegate_to_file(:extname) end
format(format='l')
click to toggle source
# File lib/ru/file.rb, line 21 def format(format='l') separator = "\t" case format when 'l' datetime = ctime.strftime(%w{%Y-%m-%d %H:%M}.join(separator)) return [omode, owner, group, size, datetime, name].join(separator) else raise 'format not supported' end end
ftype()
click to toggle source
# File lib/ru/file.rb, line 32 def ftype delegate_to_file(:ftype) end
gid()
click to toggle source
# File lib/ru/file.rb, line 36 def gid delegate_to_stat(:gid) end
group()
click to toggle source
# File lib/ru/file.rb, line 40 def group Etc.getgrgid(gid).name end
mode()
click to toggle source
# File lib/ru/file.rb, line 44 def mode delegate_to_stat(:mode) end
mtime()
click to toggle source
# File lib/ru/file.rb, line 48 def mtime delegate_to_file(:mtime) end
Also aliased as: updated_at
omode()
click to toggle source
# File lib/ru/file.rb, line 52 def omode '%o' % world_readable? end
owner()
click to toggle source
# File lib/ru/file.rb, line 56 def owner Etc.getpwuid(uid).name end
size()
click to toggle source
# File lib/ru/file.rb, line 60 def size delegate_to_file(:size) end
to_s()
click to toggle source
# File lib/ru/file.rb, line 64 def to_s name end
uid()
click to toggle source
# File lib/ru/file.rb, line 68 def uid delegate_to_stat(:uid) end
world_readable?()
click to toggle source
# File lib/ru/file.rb, line 72 def world_readable? delegate_to_stat(:world_readable?) end
Private Instance Methods
delegate_to_file(method)
click to toggle source
# File lib/ru/file.rb, line 86 def delegate_to_file(method) ::File.send(method, @path) end
delegate_to_stat(method)
click to toggle source
# File lib/ru/file.rb, line 90 def delegate_to_stat(method) ::File.stat(@path).send(method) end