[Groonga-commit] droonga/droonga-engine at b020393 [master] Define shorthand to store/get role of myself

Back to archive index

YUKI Hiroshi yuki****@clear*****
Tue Apr 21 13:35:30 JST 2015


確かに冗長でした。
mineに改めました。

> あと、これって文字列で返したほうがいいんでしょうか。
> roleを受け付ける側がNodeRoleオブジェクトを期待するようにした
> 方が全体としてスッキリしないですかねぇ。

便宜的に設けたクラスなので、あまり外でインスタンスを使わせたくないんです
よね。
ということで、そもそも大抵の場合ではインスタンスを使わないで済むような感
じに改めました。


Kouhei Sutou wrote:
>> +      def my_role
> 
> NodeRole.my_roleというようにroleがかぶっているので違う名前が
> いいんじゃないですかねぇ。NodeRole.myselfとか?
> 
>> +      def my_role
>> +        if @my_role
>> +          @my_role.to_s
>> +        else
>> +          SERVICE_PROVIDER
>> +        end
>> +      end
> 
> あと、これって文字列で返したほうがいいんでしょうか。
> roleを受け付ける側がNodeRoleオブジェクトを期待するようにした
> 方が全体としてスッキリしないですかねぇ。
> 
> In <b020393be4a29b8e0e11b940c94503f8b9dc6025 �� jenkins.clear-code.com>
>    "[Groonga-commit] droonga/droonga-engine �� b020393 [master] Define shorthand to store/get role of myself" on Tue, 21 Apr 2015 12:01:15 +0900,
>    YUKI Hiroshi <null+groonga �� clear-code.com> wrote:
> 
>> YUKI Hiroshi	2015-04-21 12:01:15 +0900 (Tue, 21 Apr 2015)
>>
>>    New Revision: b020393be4a29b8e0e11b940c94503f8b9dc6025
>>    https://github.com/droonga/droonga-engine/commit/b020393be4a29b8e0e11b940c94503f8b9dc6025
>>
>>    Message:
>>      Define shorthand to store/get role of myself
>>
>>    Modified files:
>>      lib/droonga/node_role.rb
>>
>>    Modified: lib/droonga/node_role.rb (+13 -0)
>> ===================================================================
>> --- lib/droonga/node_role.rb    2015-04-21 12:00:50 +0900 (e405d4c)
>> +++ lib/droonga/node_role.rb    2015-04-21 12:01:15 +0900 (b9c0605)
>> @@ -29,6 +29,19 @@ module Droonga
>>         def valid?(role)
>>           ROLES.include?(role)
>>         end
>> +
>> +      def my_role
>> +        if @my_role
>> +          @my_role.to_s
>> +        else
>> +          SERVICE_PROVIDER
>> +        end
>> +      end
>> +
>> +      def my_role=(new_role)
>> +        @my_role = new(new_role)
>> +        @my_role.to_s
>> +      end
>>       end
>>   
>>       def initialize(role)
> 
> _______________________________________________
> Groonga-commit mailing list
> Groonga-commit �� lists.sourceforge.jp
> http://lists.sourceforge.jp/mailman/listinfo/groonga-commit
> 

-- 
結城 洋志 <YUKI Hiroshi>
E-mail: yuki �� clear-code.com

株式会社クリアコード
〒170-0005 東京都豊島区南大塚3-29-9
           中野ビル3階
TEL : 03-5927-9440
FAX : 03-5927-9441
WWW : http://www.clear-code.com/




More information about the Groonga-commit mailing list
Back to archive index