Module: M

Extended by:
M
Includes:
Mangdown
Included in:
M
Defined in:
lib/mangdown/commands.rb

Constant Summary collapse

DATA_FILE_PATH =
Dir.home + '/.manga_list.yml'
HELP_FILE_PATH =
File.expand_path(
  '../../doc/help.txt', File.dirname(__FILE__)
)
MANGA_PAGES =
(1..9).map { |p| 
  "http://www.wiemanga.com/search/?name_sel=contain" +
  "&author_sel=contain&completed_series=either&page=#{p}.html"
} +
[
  'http://www.mangareader.net/alphabetical',
  'http://mangafox.me/manga/'
]

Constants included from Mangdown

Mangdown::ADAPTERS

Instance Method Summary collapse

Instance Method Details

#cbz(dir) ⇒ Object

cbz all subdirectories in a directory



28
29
30
# File 'lib/mangdown/commands.rb', line 28

def cbz(dir)
Dir.exist?(dir) ? (CBZ.all(dir)) : (raise Errno::ENOENT, dir) 
end

#clean_upObject

delete data file



38
39
40
# File 'lib/mangdown/commands.rb', line 38

def clean_up
  File.delete(DATA_FILE_PATH) if File.exist?(DATA_FILE_PATH)
end

#find(search) ⇒ Object

return a list of hash with :uri and :name of mangas found in list



20
21
22
23
24
25
# File 'lib/mangdown/commands.rb', line 20

def find(search)
  validate_search(search)
  current_manga_list.mangas.select { |manga| 
    manga[:name].downcase.include?(search.downcase) 
  }
end

#helpObject

display help file



33
34
35
# File 'lib/mangdown/commands.rb', line 33

def help
  puts File.open(HELP_FILE_PATH, 'r').read
end