Class: JsDuck::Img::DirSet

Inherits:
Object
  • Object
show all
Defined in:
lib/jsduck/img/dir_set.rb

Overview

A collection if Img::Dir objects.

Looks up images from directories specified through –images option.

This class provides the same interface as Img::Dir, except that the constructor takes array of full_paths not just one.

Instance Method Summary collapse

Constructor Details

#initialize(full_paths, relative_path) ⇒ DirSet

Returns a new instance of DirSet.



16
17
18
# File 'lib/jsduck/img/dir_set.rb', line 16

def initialize(full_paths, relative_path)
  @dirs = full_paths.map {|path| Img::Dir.new(path, relative_path) }
end

Instance Method Details

#all_usedObject



29
30
31
# File 'lib/jsduck/img/dir_set.rb', line 29

def all_used
  @dirs.map {|dir| dir.all_used }.flatten
end

#get(filename) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/jsduck/img/dir_set.rb', line 20

def get(filename)
  @dirs.each do |dir|
    if img = dir.get(filename)
      return img
    end
  end
  return nil
end

#report_unusedObject



33
34
35
# File 'lib/jsduck/img/dir_set.rb', line 33

def report_unused
  @dirs.each {|dir| dir.report_unused }
end