Class: File::Stat

Inherits:
Object
  • Object
show all
Defined in:
lib/rbfind/core.rb

Instance Method Summary collapse

Instance Method Details

#identical?(oth) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
33
# File 'lib/rbfind/core.rb', line 30

def identical? oth
  oth = self.class.new oth unless self.class === oth
  dev == oth.dev and ino == oth.ino
end

#modesObject



63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/rbfind/core.rb', line 63

def modes
  r = ""
  m = mode
  3.times {
    r.insert 0, ((m & 01).nonzero? ? "x" : "-")
    r.insert 0, ((m & 02).nonzero? ? "w" : "-")
    r.insert 0, ((m & 04).nonzero? ? "r" : "-")
    m >>= 3
  }
  (m & 04).nonzero? and r[ 2] = r[ 2] == "x" ? "s" : "S"
  (m & 02).nonzero? and r[ 5] = r[ 5] == "x" ? "s" : "S"
  (m & 01).nonzero? and r[ 8] = r[ 8] == "x" ? "t" : "T"
  r
end

#stypeObject



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/rbfind/core.rb', line 35

def stype
  case mode >> 12
  when 001 then "p"
  when 002 then "c"
  when 004 then "d"
  when 006 then "b"
  when 010 then "-"
  when 012 then "l"
  when 014 then "s"
  when 016 then "w"
  else          "?"
  end
end

#suffixObject



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/rbfind/core.rb', line 49

def suffix
  case mode >> 12
  when 001 then "|"
  when 002 then " "
  when 004 then "/"
  when 006 then " "
  when 010 then executable? ? "*" : " "
  when 012 then "@"
  when 014 then "="
  when 016 then "%"
  else          "?"
  end
end