Module: Imagechan
- Defined in:
- lib/imagechan.rb,
lib/imagechan/version.rb
Constant Summary collapse
- VERSION =
"0.2.3"
Class Method Summary collapse
- .clearlock ⇒ Object
- .dir ⇒ Object
- .get_folder_name_by_id(id) ⇒ Object
- .id_exists?(id) ⇒ Boolean
- .match_thread_url(url) ⇒ Object
- .prepare ⇒ Object
- .version ⇒ Object
- .where? ⇒ Boolean
Class Method Details
.clearlock ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/imagechan.rb', line 32 def self.clearlock if File.exists?(File.join(Imagechan.dir,"LOCK")) File.delete File.join(Imagechan.dir,"LOCK") puts "LOCK cleared!" else puts "There are nothing to unlock" end end |
.dir ⇒ Object
10 11 12 |
# File 'lib/imagechan.rb', line 10 def self.dir return File.join(Dir.home,'.imagechan') end |
.get_folder_name_by_id(id) ⇒ Object
22 23 24 25 |
# File 'lib/imagechan.rb', line 22 def self.get_folder_name_by_id(id) dir = Dir[File.join(Imagechan.dir,"*","#{id}*")].first.split(File::SEPARATOR).last return dir end |
.id_exists?(id) ⇒ Boolean
14 15 16 17 18 19 20 |
# File 'lib/imagechan.rb', line 14 def self.id_exists?(id) if Dir[File.join(Imagechan.dir,"*","#{id}*")].size > 0 return true else return false end end |
.match_thread_url(url) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/imagechan.rb', line 41 def self.match_thread_url(url) if url.match(/http:\/\/boards\.4chan\.org\/[a-z]+\/res\/[0-9]+/) true else false end end |
.prepare ⇒ Object
27 28 29 30 |
# File 'lib/imagechan.rb', line 27 def self.prepare puts "Preparing directory" Dir.mkdir(Imagechan.dir) end |
.version ⇒ Object
3 4 5 |
# File 'lib/imagechan/version.rb', line 3 def self.version return VERSION end |