Sha256: f7d7f3c17af260e2cf1da1b0b7775885ad880deb5f5cd57f6dc6e1c60ccfca78

Contents?: true

Size: 405 Bytes

Versions: 4

Compression:

Stored size: 405 Bytes

Contents

class Pathname
  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

  def image?
    file? && extname && %w(.jpg .jpeg .png .gif).include?(extname.downcase)
  end

  def hidden?
    basename.to_s[0..0] == "."
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mangos-0.0.8 lib/mangos/core_ext/pathname.rb
mangos-0.0.7 lib/mangos/core_ext/pathname.rb
mangos-0.0.6 lib/mangos/core_ext/pathname.rb
mangos-0.0.5 lib/mangos/core_ext/pathname.rb