class Raz::DirEntry

Attributes

absolute_path[R]

@return [String]

entries[RW]

@return [Hash<String, FileEntry | DirEntry>]

ignored_entries[RW]

@return [Hash<String, FileEntry | DirEntry>]

name[R]

@return [String]

Public Class Methods

new(name, absolute_path) click to toggle source

@param [String] name

# File lib/raz/entries.rb, line 68
def initialize(name, absolute_path)
  @name            = name
  @absolute_path   = absolute_path
  @entries         = {}
  @ignored_entries = {}
end

Public Instance Methods

==(other) click to toggle source
# File lib/raz/entries.rb, line 83
def ==(other)
  name == other.name && entries == other.entries
end
[](key) click to toggle source
# File lib/raz/entries.rb, line 75
def [](key)
  @entries[key]
end
[]=(key, value) click to toggle source
# File lib/raz/entries.rb, line 79
def []=(key, value)
  @entries[key] = value
end
dir_entries() click to toggle source

@return [Hash<String, FileEntry | DirEntry>]

# File lib/raz/entries.rb, line 99
def dir_entries
  entries.select { |_k, v| v.is_a?(DirEntry) }
end
file_entries() click to toggle source

@return [Hash<String, FileEntry | DirEntry>]

# File lib/raz/entries.rb, line 105
def file_entries
  entries.select { |_k, v| v.is_a?(FileEntry) }
end
recursive_entries() click to toggle source

@return [Array<FileEntry | DirEntry>]

# File lib/raz/entries.rb, line 111
def recursive_entries
  all_entries = []

  all_entries += entries.values
  all_entries += dir_entries.values.flat_map(&:recursive_entries)

  all_entries
end
recursive_ignored_empty?() click to toggle source

@return [Bool]

# File lib/raz/entries.rb, line 89
def recursive_ignored_empty?
  return false unless ignored_entries.empty?

  dir_entries.all? do |key, entry|
    entry.recursive_ignored_empty?
  end
end