[logaling-commit] logaling/logaling-command [refactor-structure] Extract TermDefaultRenderer#note

Back to archive index

Kouhei Sutou kou****@clear*****
Mon Jun 4 10:09:03 JST 2012


> +      def note
> +        note_string = super
> +        "# #{note_string}" if note_string
> +      end

後置のifで暗黙的にnilを返すのはわかりにくいのでこう書いたほ
うがいいんじゃないかと思いました!

  note_string = super
  return nil if note_string.nil?

  "# #{note_string}"

In <20120603040122.3DCF3940BA9 �� jenkins.clear-code.com>
  "[logaling-commit] logaling/logaling-command [refactor-structure] Extract TermDefaultRenderer#note" on Sun, 03 Jun 2012 11:52:33 +0900,
  null+github �� clear-code.com wrote:

> SHIMADA Koji	2012-06-03 11:52:33 +0900 (Sun, 03 Jun 2012)
> 
>   New Revision: 7273a4231a8b4129827f252836821e650746d912
> 
>   Log:
>     Extract TermDefaultRenderer#note
> 
>   Modified files:
>     lib/logaling/command/renderers.rb
> 
>   Modified: lib/logaling/command/renderers.rb (+6 -1)
> ===================================================================
> --- lib/logaling/command/renderers.rb    2012-06-03 11:50:59 +0900 (8e3a037)
> +++ lib/logaling/command/renderers.rb    2012-06-03 11:52:33 +0900 (13f330d)
> @@ -65,10 +65,15 @@ module Logaling::Command
>          unless note
>            format = target_term + "\t" + glossary_name
>          else
> -          format = target_term + "\t# " + note + "\t" + glossary_name
> +          format = target_term + "\t" + note + "\t" + glossary_name
>          end
>          printf("  %-#{@max_str_size+10}s %s\n", source_term, format)
>        end
> +
> +      def note
> +        note_string = super
> +        "# #{note_string}" if note_string
> +      end
>      end
>  
>      class TermCsvRenderer < TermRenderer
> 
> _______________________________________________
> logaling-commit mailing list
> logaling-commit �� lists.sourceforge.jp
> http://lists.sourceforge.jp/mailman/listinfo/logaling-commit




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