Class: MyManga::CLI::Commands::Find
- Inherits:
-
MyManga::CLI::Command
- Object
- Hanami::CLI::Command
- MyManga::CLI::Command
- MyManga::CLI::Commands::Find
- Defined in:
- lib/my_manga/find.rb
Overview
See desc
Instance Method Summary collapse
Methods inherited from MyManga::CLI::Command
Instance Method Details
#call(search_term:) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/my_manga/find.rb', line 11 def call(search_term:) results = MyManga.find(search_term) puts "Manga found for \"#{search_term}\"" puts '=' * (18 + search_term.length) return if results.empty? column_width = results.map { |r| r.name.length }.max puts pad('Name', column_width) + 'Url' results.each do |result| puts pad(result.name, column_width) + result.uri end end |