Class: QiitaMail::CliCore
- Inherits:
-
Object
- Object
- QiitaMail::CliCore
- Defined in:
- lib/qiita_mail/cli_core.rb
Instance Method Summary collapse
- #deliver ⇒ Object
- #file(format, filename = nil) ⇒ Object
- #init ⇒ Object
-
#initialize ⇒ CliCore
constructor
A new instance of CliCore.
Constructor Details
Instance Method Details
#deliver ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/qiita_mail/cli_core.rb', line 33 def deliver # ピックアップ puts "-- #{Time.now} --" puts "Pickup <---- Qiita.com" mail_body = pickup_and_format(:html) # メールの送信 puts "Send mail -> #{@settings.email}" mailer = Mailer.new(@settings.email_from, @settings.email, mail_body) mailer.deliver end |
#file(format, filename = nil) ⇒ Object
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/qiita_mail/cli_core.rb', line 45 def file(format, filename = nil) # ピックアップ puts "-- #{Time.now} --" puts "Pickup <------ Qiita.com" mail_body = pickup_and_format(format) # ファイルに書き込み puts "Write '#{format.to_s}' -> #{filename}" write_or_puts(filename, mail_body) end |
#init ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/qiita_mail/cli_core.rb', line 22 def init if (@settings.empty?) @settings.save puts "Create -> #{Settings.default_filename}" puts "Please edit YAML settings!" else puts "Already exists '#{Settings.default_filename}'." puts "Please edit YAML settings!" end end |