Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Termtter::Command をちょっとだけ改良する

#47

Termtter::Command をちょっとだけ改良したいです。

現状の match? メソッドがなんかきもい感じ。

経緯としては、以下のような形でコマンドを定義できるということに今更ながら気づき、この方式だと現状の match? メソッドに期待される動きが若干直感的じゃないなぁ、という感じです。


module Termtter
  class TestCommand < Command
    def initialize
      super(:name => :test)
    end 

    def execute(arg)
      puts 'execute!!'
    end 

    def match?(arg)
      true
    end 
  end 

  Client.register_command(TestCommand.new)
end

Reported by jugyo · March 18th, 2009 @ 10:54 AM

State: resolved
Milestone: ver.1.1
Assigned to: jugyo jugyo

Activity

  1. jugyo
    jugyo
    • State changed from new to resolved

    done.

    その他に、execute メソッドが call になり cmd, arg, original_text という引数を受け取るようになった。

    March 22nd, 2009 @ 11:18 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.