[logaling-commit] logaling/logaling-command [refactor-structure] Extract TermDefaultRenderer from TermRenderer

Back to archive index

Kouhei Sutou kou****@clear*****
Mon Jun 4 10:07:49 JST 2012


> +        unless note
> +          format = target_term + "\t" + glossary_name
> +        else
> +          format = target_term + "\t# " + note + "\t" + glossary_name
> +        end

unless elseよりif elseの方がわかりやすいんじゃないかと思いま
した!

In <20120603040122.2845694041D �� jenkins.clear-code.com>
  "[logaling-commit] logaling/logaling-command [refactor-structure] Extract TermDefaultRenderer from TermRenderer" on Sun, 03 Jun 2012 11:50:59 +0900,
  null+github �� clear-code.com wrote:

> SHIMADA Koji	2012-06-03 11:50:59 +0900 (Sun, 03 Jun 2012)
> 
>   New Revision: 851be4d9f14a4fc025d54069fdac0afb11458703
> 
>   Log:
>     Extract TermDefaultRenderer from TermRenderer
> 
>   Modified files:
>     lib/logaling/command/application.rb
>     lib/logaling/command/renderers.rb
> 
>   Modified: lib/logaling/command/application.rb (+1 -1)
> ===================================================================
> --- lib/logaling/command/application.rb    2012-06-03 11:35:25 +0900 (97457cc)
> +++ lib/logaling/command/application.rb    2012-06-03 11:50:59 +0900 (bf904f5)
> @@ -239,7 +239,7 @@ module Logaling::Command
>          terms.each_with_index do |term, i|
>            case options["output"]
>            when "terminal"
> -            term_renderer = Logaling::Command::Renderers::TermRenderer.new(term, @repository, @config, options)
> +            term_renderer = Logaling::Command::Renderers::TermDefaultRenderer.new(term, @repository, @config, options)
>              term_renderer.max_str_size = max_str_size
>              term_renderer.render
>            when "csv"
> 
>   Modified: lib/logaling/command/renderers.rb (+19 -11)
> ===================================================================
> --- lib/logaling/command/renderers.rb    2012-06-03 11:35:25 +0900 (dc75f1d)
> +++ lib/logaling/command/renderers.rb    2012-06-03 11:50:59 +0900 (8e3a037)
> @@ -1,24 +1,14 @@
>  module Logaling::Command
>    module Renderers
>      class TermRenderer
> -      attr_accessor :max_str_size
> -
>        def initialize(term, repository, config, options)
>          @term = term
>          @repository = repository
>          @config = config
>          @options = options
> -        @max_str_size = 0
>        end
>  
> -      def render
> -        unless note
> -          format = target_term + "\t" + glossary_name
> -        else
> -          format = target_term + "\t# " + note + "\t" + glossary_name
> -        end
> -        printf("  %-#{@max_str_size+10}s %s\n", source_term, format)
> -      end
> +      def render; end
>  
>        def glossary_name
>          if****@repos*****_counts > 1
> @@ -63,6 +53,24 @@ module Logaling::Command
>        end
>      end
>  
> +    class TermDefaultRenderer < TermRenderer
> +      attr_accessor :max_str_size
> +
> +      def initialize(term, repository, config, options)
> +        super
> +        @max_str_size = 0
> +      end
> +
> +      def render
> +        unless note
> +          format = target_term + "\t" + glossary_name
> +        else
> +          format = target_term + "\t# " + note + "\t" + glossary_name
> +        end
> +        printf("  %-#{@max_str_size+10}s %s\n", source_term, format)
> +      end
> +    end
> +
>      class TermCsvRenderer < TermRenderer
>        def render
>          items = [source_term, target_term, note,
> 
> _______________________________________________
> 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