[Groonga-commit] ranguba/ranguba at 8a2f8e3 [master] Use the default value only for title

Back to archive index
Kouhei Sutou null+****@clear*****
Thu Oct 25 12:41:15 JST 2018


Kouhei Sutou	2018-10-25 12:41:15 +0900 (Thu, 25 Oct 2018)

  Revision: 8a2f8e30ae8d46d71bb266406d79d852d0953250
  https://github.com/ranguba/ranguba/commit/8a2f8e30ae8d46d71bb266406d79d852d0953250

  Message:
    Use the default value only for title

  Modified files:
    lib/ranguba/template.rb

  Modified: lib/ranguba/template.rb (+6 -10)
===================================================================
--- lib/ranguba/template.rb    2018-10-25 12:38:20 +0900 (f4ac793)
+++ lib/ranguba/template.rb    2018-10-25 12:41:15 +0900 (c08c4a5)
@@ -2,13 +2,15 @@ class Ranguba::Template
   def initialize(encodings=nil)
     @encodings = encodings || default_encodings
     @base = Ranguba::Application.config.customize_base_path + 'templates'
-    @title_path = build_path('title.txt')
-    @header_path = build_path('header.txt')
-    @footer_path = build_path('footer.txt')
+    @title_path = @base + 'title.txt'
+    @header_path = @base + 'header.txt'
+    @footer_path = @base + 'footer.txt'
   end
 
   def title
-    @title ||= Ranguba::FileReader.read(@title_path, @encodings['title.txt'])
+    @title ||=
+      Ranguba::FileReader.read(@title_path, @encodings['title.txt']) ||
+      "Ranguba"
   end
 
   def header
@@ -27,10 +29,4 @@ class Ranguba::Template
       'footer.txt' => Encoding::UTF_8,
     }
   end
-
-  def build_path(path)
-    full_path = @base + path
-    return full_path if full_path.exist?
-    @base + "#{path}.sample"
-  end
 end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20181025/25c106e8/attachment.html>


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