Method: Glyph::Utils#load_files_from_dir

Defined in:
lib/glyph/utils.rb

#load_files_from_dir(dir, extension) {|file, contents| ... } ⇒ Object

Loads all child elements of the given directory, matching a given extension

Parameters:

  • dir (Pathname)

    the directory containing the files

  • extension (String)

    the file extension to check

Yields:

  • (file, contents)

    the file (Pathname) and its contents

Since:

  • 0.4.0



88
89
90
91
92
93
94
# File 'lib/glyph/utils.rb', line 88

def load_files_from_dir(dir, extension, &block)
  if dir.exist? then
    dir.children.each do |c|
      block.call(c, file_load(c)) unless c.directory? || c.extname != extension
    end
  end
end