[logaling-commit] logaling/logaling-command [master] Extract TermDefaultRenderer from TermRenderer

Back to archive index

null+****@clear***** null+****@clear*****
Thu Jun 28 12:02:16 JST 2012


SHIMADA Koji	2012-06-03 11:50:59 +0900 (Sun, 03 Jun 2012)

  New Revision: 851be4d9f14a4fc025d54069fdac0afb11458703
  https://github.com/logaling/logaling-command/commit/851be4d9f14a4fc025d54069fdac0afb11458703

  Merged 7228757: Merge pull request #60 from logaling/refactor-structure

  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,
-------------- next part --------------
An HTML attachment was scrubbed...
Download 



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