Module: Tins::Find::Finder::PathExtension

Defined in:
lib/tins/find.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#finderObject

Returns the value of attribute finder.



14
15
16
# File 'lib/tins/find.rb', line 14

def finder
  @finder
end

Instance Method Details

#directory?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/tins/find.rb', line 32

def directory?
  finder.protect_from_errors { s = finder_stat and s.directory? }
end

#exist?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/tins/find.rb', line 36

def exist?
  finder.protect_from_errors { File.exist?(self) }
end

#fileObject



22
23
24
25
26
# File 'lib/tins/find.rb', line 22

def file
  finder.protect_from_errors do
    File.new(self) if file?
  end
end

#file?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/tins/find.rb', line 28

def file?
  finder.protect_from_errors { s = finder_stat and s.file? }
end

#finder_statObject



16
17
18
19
20
# File 'lib/tins/find.rb', line 16

def finder_stat
  finder.protect_from_errors do
    finder.follow_symlinks ? File.stat(self) : File.lstat(self)
  end
end

#lstatObject



44
45
46
# File 'lib/tins/find.rb', line 44

def lstat
  finder.protect_from_errors { File.lstat(self) }
end

#pathnameObject



48
49
50
# File 'lib/tins/find.rb', line 48

def pathname
  Pathname.new(self)
end

#statObject



40
41
42
# File 'lib/tins/find.rb', line 40

def stat
  finder.protect_from_errors { File.stat(self) }
end

#suffixObject



52
53
54
# File 'lib/tins/find.rb', line 52

def suffix
  pathname.extname[1..-1] || ''
end