Module: Tins::Find::Finder::PathExtension
- Defined in:
- lib/tins/find.rb
Instance Attribute Summary collapse
-
#finder ⇒ Object
Returns the value of attribute finder.
Instance Method Summary collapse
- #directory? ⇒ Boolean
- #exist? ⇒ Boolean
- #file ⇒ Object
- #file? ⇒ Boolean
- #finder_stat ⇒ Object
- #lstat ⇒ Object
- #pathname ⇒ Object
- #stat ⇒ Object
- #suffix ⇒ Object
Instance Attribute Details
#finder ⇒ Object
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
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
36 37 38 |
# File 'lib/tins/find.rb', line 36 def exist? finder.protect_from_errors { File.exist?(self) } end |
#file ⇒ Object
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
28 29 30 |
# File 'lib/tins/find.rb', line 28 def file? finder.protect_from_errors { s = finder_stat and s.file? } end |
#finder_stat ⇒ Object
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 |
#lstat ⇒ Object
44 45 46 |
# File 'lib/tins/find.rb', line 44 def lstat finder.protect_from_errors { File.lstat(self) } end |
#pathname ⇒ Object
48 49 50 |
# File 'lib/tins/find.rb', line 48 def pathname Pathname.new(self) end |
#stat ⇒ Object
40 41 42 |
# File 'lib/tins/find.rb', line 40 def stat finder.protect_from_errors { File.stat(self) } end |
#suffix ⇒ Object
52 53 54 |
# File 'lib/tins/find.rb', line 52 def suffix pathname.extname[1..-1] || '' end |