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

Back to archive index

Kouhei Sutou kou****@clear*****
Tue Apr 21 12:50:39 JST 2015


> +      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)




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