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

- (Icon) initialize(fullpath)

Returns a new instance of Icon



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

def initialize(fullpath)
  @fullpath = fullpath
end

Instance Attribute Details

- (Object) fullpath (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

- (Object) <=>(other)



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

- (Object) resolution



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

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

- (Object) to_s



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

def to_s
  fullpath
end