Sha256: fe63ae6420df06994e1f1114bbbc5ac6522abcf4a1f24993b1f817f9636b062f
Contents?: true
Size: 588 Bytes
Versions: 1
Compression:
Stored size: 588 Bytes
Contents
# frozen_string_literal: true require_relative 'file_info' module Kitkat # Directory operations. class Reader include Enumerable attr_reader :root def initialize(root) @root = File.expand_path(root) freeze end def each(&block) return enum_for(:each) unless block_given? traverse(root, &block) self end private def traverse(dir, &block) Dir[File.join(dir, '*')].each do |path| yield FileInfo.new(path, root: root) traverse(path, &block) if File.directory?(path) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kitkat-0.0.2 | lib/kitkat/reader.rb |