[from now] 2013/08/05 19:26:04

diff --git a/lib/kptchan.rb b/lib/kptchan.rb
index 14b0efe..247b5d1 100644
--- a/lib/kptchan.rb
+++ b/lib/kptchan.rb
@@ -11,6 +11,7 @@ require "pry"
 REQUEST_DICTIONARIES = [
   [:add, ['add', 'Add', 'ADD', '足す', '足し', '加え']],
   [:remove, ['remove', 'Remove', 'REMOVE', '消']],
+  [:complete, ['done', 'Done', 'complete', 'ダン', '終わ']],
   [:list, ['list', 'List', 'LIST', 'リスト', '一覧']]
 ]

@@ -47,7 +48,14 @@ end
 class Interpreter
   def interpret(parsed_sentence, speaker_nickname)
     @sentence = parsed_sentence
-    {speaker_nickname: speaker_nickname, request: request, category: category, content: content}
+
+    {
+      speaker_nickname: speaker_nickname,
+      request: request,
+      category: category,
+      content: content,
+      specified_inc_id: specified_inc_id
+    }
   end

   private
@@ -75,6 +83,11 @@ class Interpreter
     @sentence =~ /(?<=\").{1,}(?=\")/
     $&
   end
+
+  def specified_inc_id
+    @sentence =~ /(?<=id\:)\d{1,}/
+    $&.to_i
+  end
 end

@@ -114,13 +127,10 @@ class KPTChanController
     # TODO: 条件はこれでいいのか？
     return until msg[:request] && msg[:category]

-    # Behavior.send msg[:request].to_sym,
-    #               @client
-    #               msg[:speaker_nickname], msg[:category], msg[:content]
     options = {
       category: msg[:category],
       content: msg[:content],
-      specified_id: msg[:specified_id]
+      specified_inc_id: msg[:specified_inc_id]
     }

     Behavior.send msg[:request].to_sym,
@@ -149,11 +159,14 @@ module Behavior
   end

   def self.complete(client, speaker_nickname, options)
-    Task.where(inc_id: options[:inc_id]).update(done: true)
+    Task.where(inc_id: options[:specified_inc_id]).update(done: true)
   end

-  def self.disable(client, speaker_nickname, options)
-    Task.where(inc_id: options[:inc_id]).update(available: false)
+  def self.remove(client, speaker_nickname, options)
+    binding.pry
+    pp Task.find_by(inc_id: options[:specified_inc_id])
+    Task.where(inc_id: options[:specified_inc_id]).update(available: false)
+    "#{options[:specified_inc_id]}を削除しました。"
   end

   def self.list(client, speaker_nickname, options)
@@ -161,7 +174,7 @@ module Behavior

     client.notice "#{client.channel}", "#{options[:category]}"
     list.each do |elem|
-      # TODO spaceや:が途中に入ると上手く出力できない。必要であればzirconのコードを修正。
+      # TODO: spaceや:が途中に入ると上手く出力できない。必要であればzirconのコードを修正。
       client.notice "#{client.channel}", "#{elem.inc_id}.#{elem.content}(#{elem.created_at.strftime('%Y-%m-%d_%H:%M')})"
     end
   end