Class: Command::Inspect
- Inherits:
-
CommandBase
- Object
- CommandBase
- Command::Inspect
- Defined in:
- lib/command/inspect.rb
Instance Method Summary collapse
- #display_log(title) ⇒ Object
- #execute(argv) ⇒ Object
-
#initialize ⇒ Inspect
constructor
A new instance of Inspect.
- #oneline_help ⇒ Object
Methods inherited from CommandBase
Constructor Details
#initialize ⇒ Inspect
Returns a new instance of Inspect.
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/command/inspect.rb', line 18 def initialize super("[<target> ...]") @opt.separator "\n \u30FB\u5F15\u6570\u3092\u6307\u5B9A\u3057\u306A\u304B\u3063\u305F\u5834\u5408\u306F\u76F4\u524D\u306B\u5909\u63DB\u3057\u305F\u5C0F\u8AAC\u306E\u72B6\u614B\u8ABF\u67FB\u72B6\u6CC1\u30ED\u30B0\u3092\u8868\u793A\u3057\u307E\u3059\u3002\n \u30FB\u5C0F\u8AAC\u3092\u6307\u5B9A\u3057\u305F\u5834\u5408\u306F\u305D\u306E\u5C0F\u8AAC\u306E\u30ED\u30B0\u3092\u8868\u793A\u3057\u307E\u3059\u3002\n \u30FBnarou setting convert.inspect=true \u3068\u3059\u308C\u3070\u5909\u63DB\u6642\u306B\u5E38\u306B\u8868\u793A\u3055\u308C\u308B\u3088\u3046\u306B\u306A\u308A\u307E\u3059\u3002\n\n Example:\nnarou inspect # \u76F4\u524D\u306E\u5909\u63DB\u6642\u306E\u30ED\u30B0\u3092\u8868\u793A\nnarou inspect 6 # \u30ED\u30B0\u3092\u8868\u793A\u3057\u305F\u3044\u5C0F\u8AAC\u3092\u6307\u5B9A\u3059\u308B\n EOS\nend\n" |
Instance Method Details
#display_log(title) ⇒ Object
53 54 55 56 57 |
# File 'lib/command/inspect.rb', line 53 def display_log(title) puts "(#{title} の小説状態調査状況ログ)" novel_setting = NovelSetting.load(title) puts Inspector.(novel_setting) || "調査ログがまだ無いようです" end |
#execute(argv) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/command/inspect.rb', line 32 def execute(argv) super if argv.empty? latest_id = LocalSetting.get["latest_convert"]["id"] if latest_id data = Downloader.get_data_by_target(latest_id) display_log(data["title"]) end return end argv.each_with_index do |target, i| Helper.print_horizontal_rule if i > 0 data = Downloader.get_data_by_target(target) unless data error "#{target} は存在しません" next end display_log(data["title"]) end end |
#oneline_help ⇒ Object
14 15 16 |
# File 'lib/command/inspect.rb', line 14 def oneline_help "小説状態の調査状況ログを表示します" end |