Sha256: 6b1c23e3495a0f6db498d564f35e61c4391b4aad84d23481df7c6367d57bf623

Contents?: true

Size: 874 Bytes

Versions: 29

Compression:

Stored size: 874 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'
require 'eac_templates/abstract/directory'
require 'eac_templates/sources/fs_object'

module EacTemplates
  module Sources
    class Directory < ::EacTemplates::Abstract::Directory
      include ::EacTemplates::Sources::FsObject

      # @return [Hash<Pathname, Symbol>]
      def children_basenames
        r = {}
        real_paths.each do |real_path|
          real_path.children.each do |child|
            next if r.key?(child.basename)

            r[child.basename] = real_path_type(child)
          end
        end
        r
      end

      # @return [Pathname]
      def real_path_type(path)
        if path.file?
          :file
        elsif path.directory?
          :directory
        else
          raise "Path \"#{path}\" is not a file nor a directory"
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
eac_templates-0.7.1 lib/eac_templates/sources/directory.rb
eac_tools-0.93.0 sub/eac_templates/lib/eac_templates/sources/directory.rb
eac_templates-0.7.0 lib/eac_templates/sources/directory.rb
eac_tools-0.91.0 sub/eac_templates/lib/eac_templates/sources/directory.rb
eac_templates-0.5.1 lib/eac_templates/sources/directory.rb
eac_tools-0.76.0 sub/eac_templates/lib/eac_templates/sources/directory.rb
eac_tools-0.75.2 sub/eac_templates/lib/eac_templates/sources/directory.rb
eac_tools-0.75.1 sub/eac_templates/lib/eac_templates/sources/directory.rb
eac_tools-0.75.0 sub/eac_templates/lib/eac_templates/sources/directory.rb
eac_tools-0.74.1 sub/eac_templates/lib/eac_templates/sources/directory.rb
eac_tools-0.74.0 sub/eac_templates/lib/eac_templates/sources/directory.rb
eac_tools-0.73.0 sub/eac_templates/lib/eac_templates/sources/directory.rb
eac_tools-0.72.0 sub/eac_templates/lib/eac_templates/sources/directory.rb
eac_tools-0.70.1 sub/eac_templates/lib/eac_templates/sources/directory.rb
eac_tools-0.70.0 sub/eac_templates/lib/eac_templates/sources/directory.rb
eac_tools-0.69.1 sub/eac_templates/lib/eac_templates/sources/directory.rb
eac_tools-0.69.0 sub/eac_templates/lib/eac_templates/sources/directory.rb
eac_tools-0.68.0 sub/eac_templates/lib/eac_templates/sources/directory.rb
eac_tools-0.67.1 sub/eac_templates/lib/eac_templates/sources/directory.rb
eac_tools-0.67.0 sub/eac_templates/lib/eac_templates/sources/directory.rb