Commit a56de3c

mo <mo.khan@gmail.com>
2018-02-27 04:01:24
cache template_path.
1 parent 4da2824
Changed files (1)
lib/saml/kit/xml_templatable.rb
@@ -6,9 +6,12 @@ module Saml
       include ::Xml::Kit::Templatable
 
       def template_path
-        root_path = __dir__
-        template_name = "#{self.class.name.split('::').last.underscore}.builder"
-        File.join(root_path, 'builders/templates/', template_name)
+        @template_path ||=
+          begin
+            root_path = __dir__
+            template_name = "#{self.class.name.split('::').last.underscore}.builder"
+            File.join(root_path, 'builders/templates/', template_name)
+          end
       end
 
       # Returns true if an embedded signature is requested and at least one signing certificate is available via the configuration.