Skip to content

Commit

Permalink
MailGenerator: コードを整形する
Browse files Browse the repository at this point in the history
  • Loading branch information
ochaochaocha3 committed Jan 9, 2018
1 parent 133f2a1 commit 9813fde
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions lib/rgrb/plugin/server_connection_report/mail_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,11 @@ def configure(config_data)
end

to_config = mail_config['To']
if to_config
@to = to_config
end
@to = to_config if to_config
end

logger = config_data[:logger]
if logger
@logger = logger
end
@logger = logger if logger

self
end
Expand Down Expand Up @@ -172,10 +168,11 @@ def generate(server, status, time, message = '')
mail.delivery_method(:smtp, @mail_config)
mail.charset = 'utf-8'
mail.to = @to

{
from: '%{nick} on %{network} <rgrb-%{nick}@%{host}>',
subject: @subject,
body: @body
from: '%{nick} on %{network} <rgrb-%{nick}@%{host}>',
subject: @subject,
body: @body
}.each do |key, value|
mail[key] = value % data_parts
end
Expand All @@ -187,9 +184,9 @@ def generate(server, status, time, message = '')
# @param [Hash] hash 変換元のハッシュテーブル
# @return [Hash]
def symbolize_keys(hash)
hash.map { |key, value|
[key.to_sym, value]
}.to_h
hash.
map { |key, value| [key.to_sym, value] }.
to_h
end
private :symbolize_keys
end
Expand Down

0 comments on commit 9813fde

Please sign in to comment.