[logaling-commit] logaling/logaling-command [refactor-structure] Extract TermJsonRenderer#first_line?, last_line?

Back to archive index

Kouhei Sutou kou****@clear*****
Mon Jun 4 10:04:14 JST 2012


> +      private
> +      def first_line?
> +        @index == 0
> +      end
> +      def last_line?
> +        @index == @last_index-1

メソッド定義の間には空行を入れたほうがよいと思いました!

In <20120602085248.29E8B94046F �� jenkins.clear-code.com>
  "[logaling-commit] logaling/logaling-command [refactor-structure] Extract TermJsonRenderer#first_line?, last_line?" on Sat, 02 Jun 2012 17:48:20 +0900,
  null+github �� clear-code.com wrote:

> SHIMADA Koji	2012-06-02 17:48:20 +0900 (Sat, 02 Jun 2012)
> 
>   New Revision: 4402b278ca52af68173e7183fc276e5e7813edeb
> 
>   Log:
>     Extract TermJsonRenderer#first_line?, last_line?
> 
>   Modified files:
>     lib/logaling/command/renderers.rb
> 
>   Modified: lib/logaling/command/renderers.rb (+10 -3)
> ===================================================================
> --- lib/logaling/command/renderers.rb    2012-06-02 17:35:46 +0900 (0c6cac5)
> +++ lib/logaling/command/renderers.rb    2012-06-02 17:48:20 +0900 (5714fa5)
> @@ -72,15 +72,22 @@ module Logaling::Command
>        end
>  
>        def render
> -        puts("[") if @index == 0
> -        puts(",") if @index > 0
> +        first_line? ? puts("[") : puts(",")
>          record = {
>            :source => source_term, :target => target_term, :note => note,
>            :source_language => @config.source_language,
>            :target_language => @config.target_language
>          }
>          print JSON.pretty_generate(record)
> -        puts("\n]") if @index == @last_index-1
> +        puts("\n]") if last_line?
> +      end
> +
> +      private
> +      def first_line?
> +        @index == 0
> +      end
> +      def last_line?
> +        @index == @last_index-1
>        end
>      end
>    end
> 
> _______________________________________________
> 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