Class: Libnotify::IconFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/libnotify/icon_finder.rb

Defined Under Namespace

Classes: Icon

Instance Method Summary (collapse)

Constructor Details

- (IconFinder) initialize(dirs)



3
4
5
# File 'lib/libnotify/icon_finder.rb', line 3

def initialize(dirs)
  @dirs = dirs
end

Instance Method Details

- (Object) icon_path(name)



7
8
9
10
11
12
13
14
15
# File 'lib/libnotify/icon_finder.rb', line 7

def icon_path(name)
  list = @dirs.map do |dir|
    glob = File.join(dir, name)
    Dir[glob].map { |fullpath| Icon.new(fullpath) }
  end
  if found = list.flatten.sort.first
    found.to_s
  end
end