Class: Gnome::Wallpaper::Changer::Controller

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/gnome-wallpaper-changer/controller.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.main_fileObject



8
9
10
# File 'lib/gnome-wallpaper-changer/controller.rb', line 8

def self.main_file
  __FILE__
end

Instance Method Details

#sanitize_path(folder) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/gnome-wallpaper-changer/controller.rb', line 12

def sanitize_path folder
  if folder.empty?
    return nil
  end

  folder_pn = Pathname.new folder

  if folder_pn.relative?
    return nil
  end

  folder_pn = folder_pn.expand_path

  if !folder_pn.exist?
    return nil
  end

  folder_pn.to_s
end