Sha256: 9e9e2cbab2e528222245b02f137597bd7f6a0c6a1bf7dca6951c9df2c33f2b09

Contents?: true

Size: 385 Bytes

Versions: 4

Compression:

Stored size: 385 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? && %w(.jpg .jpeg .png .gif).include?(extname)
  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.4 lib/mangos/core_ext/pathname.rb
mangos-0.0.3 lib/mangos/core_ext/pathname.rb
mangos-0.0.2 lib/mangos/core_ext/pathname.rb
mangos-0.0.1 lib/mangos/core_ext/pathname.rb