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



22
23
24
# File 'lib/libnotify/icon_finder.rb', line 22

def initialize(fullpath)
  @fullpath = fullpath
end

Instance Attribute Details

#fullpathObject (readonly)

Returns the value of attribute fullpath



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

def fullpath
  @fullpath
end

Instance Method Details

#<=>(other) ⇒ Object



35
36
37
38
39
# File 'lib/libnotify/icon_finder.rb', line 35

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

#resolutionObject



27
28
29
# File 'lib/libnotify/icon_finder.rb', line 27

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

#to_sObject



31
32
33
# File 'lib/libnotify/icon_finder.rb', line 31

def to_s
  fullpath
end