Class: Utopia::Gallery::Container

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Container.



30
31
32
33
34
# File 'lib/utopia/gallery/container.rb', line 30

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

Instance Attribute Details

#filterObject (readonly)

Returns the value of attribute filter.



38
39
40
# File 'lib/utopia/gallery/container.rb', line 38

def filter
  @filter
end

#pathObject (readonly)

Returns the value of attribute path.



37
38
39
# File 'lib/utopia/gallery/container.rb', line 37

def path
  @path
end

#rootObject (readonly)

Returns the value of attribute root.



36
37
38
# File 'lib/utopia/gallery/container.rb', line 36

def root
  @root
end

Instance Method Details

#eachObject



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/utopia/gallery/container.rb', line 40

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