Class: Utopia::Gallery::Container

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/utopia/gallery/container.rb

Instance Method Summary collapse

Constructor Details

#initialize(root, path, filter: /(jpe?g|png)$/i) ⇒ Container



28
29
30
31
32
# File 'lib/utopia/gallery/container.rb', line 28

def initialize(root, path, filter: /(jpe?g|png)$/i)
  @root = root
  @path = path
  @filter = filter
end

Instance Method Details

#eachObject



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/utopia/gallery/container.rb', line 34

def each
  return to_enum unless block_given?
  
   = 
  
  entries.each do |name|
    path = File.join(@path, name)
     = .delete(name)
    
    yield Media.new(path,  || {})
  end
end