lib/dir_model/import.rb in dir_model-0.3.0 vs lib/dir_model/import.rb in dir_model-0.3.1

- old
+ new

@@ -43,25 +43,24 @@ attr_reader :load_state, :file_infos def match? return if load_state == :loaded + @_match = loader { find_match } + end + alias_method :load, :match? - @_match ||= begin - loader do - self.class.file_names.each do |file_name| - options = self.class.options(file_name) + def find_match + self.class.file_names.each do |file_name| + options = self.class.options(file_name) - if match = (source_path||'').match(options[:regex].call) - @file_infos = { file: file_name, options: options.merge(match: match) } - return true - end - end - false + if match = (source_path||'').match(options[:regex].call) + @file_infos = { file: file_name, options: options.merge(match: match) } + return true end end + false end - alias_method :load, :match? def loader @load_state = :loading result = yield @load_state = :loaded