Class: Libnotify::IconFinder
- Inherits:
-
Object
- Object
- Libnotify::IconFinder
- Defined in:
- lib/libnotify/icon_finder.rb
Defined Under Namespace
Classes: Icon
Instance Method Summary collapse
- #icon_path(name) ⇒ Object
-
#initialize(dirs) ⇒ IconFinder
constructor
A new instance of IconFinder.
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 |