From cecde3a6c41e529d74615de0ced0b4f34d87caa9 Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 15 Jun 2009 19:57:50 +0200 Subject: add video? audio? image? methods to Directory::Entry i have also added aliases for backward compatibility --- code/entry.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'code/entry.rb') diff --git a/code/entry.rb b/code/entry.rb index 7a17bb65..0582c280 100644 --- a/code/entry.rb +++ b/code/entry.rb @@ -27,7 +27,6 @@ class Directory::Entry @basename = File.basename(dirname) end @name, @ext = @basename.split_at_last_dot - @movie = MOVIE_EXTENSIONS.include?(@ext) @size = 0 @exists = false @rights = '----------' @@ -55,12 +54,16 @@ class Directory::Entry def marked?() @marked end def symlink?() @symlink end def socket?() @type == :socket end - def movie?() @movie end + def video?() @video ||= @mimetype && @mimetype =~ /^video\// end + def audio?() @sound ||= @mimetype && @mimetype =~ /^audio\// end + def image?() @image ||= @mimetype && @mimetype =~ /^image\// end def broken_symlink?() @symlink and !@exists end def dir?() @type == :dir end def file?() @type == :file end def writable?() @writable end def executable?() @executable end + alias movie? video? + alias sound? audio? def handler() ## get_handler has to be defined in another file -- cgit 1.4.1-2-gfad0 hlt'>summary refs log tree commit diff stats
path: root/html/406int32.mu.html
blob: c7d06f060b7e3962dc9f8c37b1a8b70d0f926faf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101