Module: Steep::Drivers::Utils::EachSignature

Included in:
Annotations, Check, PrintInterface, Scaffold, Validate, Watch
Defined in:
lib/steep/drivers/utils/each_signature.rb

Instance Method Summary collapse

Instance Method Details

#each_file_in_dir(suffix, path, &block) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/steep/drivers/utils/each_signature.rb', line 17

def each_file_in_dir(suffix, path, &block)
  path.children.each do |child|
    if child.directory?
      each_file_in_dir(suffix, child, &block)
    end

    if child.file? && suffix == child.extname
      yield child
    end
  end
end

#each_file_in_path(suffix, path) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/steep/drivers/utils/each_signature.rb', line 5

def each_file_in_path(suffix, path)
  if path.file?
    yield path
  end

  if path.directory?
    each_file_in_dir(suffix, path) do |file|
      yield file
    end
  end
end