Sha256: c5871de22a8b4f99e08eb47afecd22f310ee46fa1d7bf7ec7cb16da93e0e5352

Contents?: true

Size: 523 Bytes

Versions: 14

Compression:

Stored size: 523 Bytes

Contents

# frozen_string_literal: true

module FactoryBotRails
  class DefinitionFilePaths
    def initialize(definition_file_paths)
      @files = []
      @directories = {}

      definition_file_paths.each do |path|
        @files << "#{path}.rb"
        @directories[path.to_s] = [:rb]
      end
    end

    def directories
      @directories.select { |path| Dir.exist?(path) }
    end

    def files
      @files.select { |file| File.exist?(file) }
    end

    def any?
      directories.any? || files.any?
    end
  end
end

Version data entries

14 entries across 13 versions & 2 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/factory_bot_rails-6.4.4/lib/factory_bot_rails/definition_file_paths.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/factory_bot_rails-6.4.4/lib/factory_bot_rails/definition_file_paths.rb
factory_bot_rails-6.4.4 lib/factory_bot_rails/definition_file_paths.rb
factory_bot_rails-6.4.3 lib/factory_bot_rails/definition_file_paths.rb
factory_bot_rails-6.4.2 lib/factory_bot_rails/definition_file_paths.rb
factory_bot_rails-6.4.0 lib/factory_bot_rails/definition_file_paths.rb
factory_bot_rails-6.3.0 lib/factory_bot_rails/definition_file_paths.rb
factory_bot_rails-6.2.0 lib/factory_bot_rails/definition_file_paths.rb
factory_bot_rails-6.1.0 lib/factory_bot_rails/definition_file_paths.rb
factory_bot_rails-6.0.0 lib/factory_bot_rails/definition_file_paths.rb
factory_bot_rails-5.2.0 lib/factory_bot_rails/definition_file_paths.rb
factory_bot_rails-5.1.1 lib/factory_bot_rails/definition_file_paths.rb
factory_bot_rails-5.1.0 lib/factory_bot_rails/definition_file_paths.rb
factory_bot_rails-5.0.2 lib/factory_bot_rails/definition_file_paths.rb