Class: Libnotify::IconFinder::Icon

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

Constant Summary

ICON_REGEX =
/(\d+)x\d+/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fullpath) ⇒ Icon

Returns a new instance of Icon



20
21
22
# File 'lib/libnotify/icon_finder.rb', line 20

def initialize(fullpath)
  @fullpath = fullpath
end

Instance Attribute Details

#fullpathObject (readonly)

Returns the value of attribute fullpath



18
19
20
# File 'lib/libnotify/icon_finder.rb', line 18

def fullpath
  @fullpath
end

Instance Method Details

#<=>(other) ⇒ Object



33
34
35
36
37
# File 'lib/libnotify/icon_finder.rb', line 33

def <=>(other)
  result = other.resolution <=> self.resolution
  result = self.fullpath    <=> other.fullpath if result == 0
  result
end

#resolutionObject



25
26
27
# File 'lib/libnotify/icon_finder.rb', line 25

def resolution
  @resolution ||= @fullpath[ICON_REGEX, 1].to_i
end

#to_sObject



29
30
31
# File 'lib/libnotify/icon_finder.rb', line 29

def to_s
  fullpath
end