Skip to content

Commit

Permalink
LogSaver: DATABASE-OBJECT.create メソッドを使うようにして、db_insert を廃止した
Browse files Browse the repository at this point in the history
  • Loading branch information
koi-chan committed Mar 30, 2016
1 parent 1b810cc commit ea1e765
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/rgrb/plugin/log_saver/irc_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def receive(m)
return if channel_id == nil

prefix = m.prefix.split(/[!@]/)
db_insert({
Database::Log.create({
timestamp: m.time,
nickname: prefix[0],
username: prefix[1],
Expand Down Expand Up @@ -165,12 +165,12 @@ def database_uri(config)
# @option [Hash<Fixnum>] :channel_id チャンネル ID
# @option [Hash<String>] :message IRCコマンドの引数
# @return [void]
def db_insert(log)
db = Database::Log.new
db.attributes = log
db.save
end
private :db_insert
# def db_insert(log)
# db = Database::Log.new
# db.attributes = log
# db.save
# end
# private :db_insert

# チャンネルのログ公開URLを返す
# @param [String] downcase チャンネルの downcase 名
Expand Down Expand Up @@ -209,7 +209,7 @@ def send(prefix, message, m)
message.each_line do |line|
line.chomp!
channel.send(prefix + line, true)
db_insert({
Database::Log.create({
timestamp: Time.now,
nickname: bot.nick,
username: bot.user,
Expand Down

0 comments on commit ea1e765

Please sign in to comment.