Class: Pathname
- Inherits:
-
Object
- Object
- Pathname
- Defined in:
- lib/mangos/core_ext/pathname.rb
Instance Method Summary collapse
Instance Method Details
#descendant_directories ⇒ Object
2 3 4 5 6 7 8 9 10 11 |
# File 'lib/mangos/core_ext/pathname.rb', line 2 def descendant_directories out = [] children.select { |p| p.directory? && !p.hidden? }.each do |p| if p.children.any? { |c| c.image? } out << p end out += p.descendant_directories end out end |
#hidden? ⇒ Boolean
17 18 19 |
# File 'lib/mangos/core_ext/pathname.rb', line 17 def hidden? basename.to_s[0..0] == "." end |
#image? ⇒ Boolean
13 14 15 |
# File 'lib/mangos/core_ext/pathname.rb', line 13 def image? file? && extname && %w(.jpg .jpeg .png .gif).include?(extname.downcase) end |