lib/tck/lambdas/aws_function.rb in tck-lambdas-0.3.3 vs lib/tck/lambdas/aws_function.rb in tck-lambdas-0.3.4

- old
+ new

@@ -11,20 +11,31 @@ def self.tmpdir @tmpdir ||= Dir.tmpdir + "/tck-lambdas" end def self.yaml - @yaml ||= File.exist?('.lambdas.yml') ? YAML.load_file('.lambdas.yml') : nil + if File.exist?('.lambdas.yml') + current_timestamp = File.mtime('.lambdas.yml') + if @timestamp == current_timestamp + @yaml + else + @timestamp = current_timestamp + @yaml = YAML.load_file('.lambdas.yml') + end + else + {} + end end def self.clean_tmps! FileUtils.mkdir_p tmpdir FileUtils.rm_rf Dir.glob("#{tmpdir}/*") end def initialize(name) @name = name.to_s - @conf = yaml ? yaml[@name] : {} + @conf = yaml && yaml[@name] || {} + @timestamp = nil end def function_name @conf['function-name'] || name end