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

#initialize(dirs) ⇒ IconFinder

Returns a new instance of IconFinder.



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

def initialize(dirs)
  @dirs = dirs
end

Instance Method Details

#icon_path(name) ⇒ Object



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