Sha256: 889646faade76a1298df4781d89997e22d10793c6e62907b32eb36bfb004b6cc

Contents?: true

Size: 842 Bytes

Versions: 3

Compression:

Stored size: 842 Bytes

Contents

#          Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the Ruby license.

# Extensions for Kernel

module Kernel

  # Require all .rb and .so files on the given globs, utilizes Dir::[].
  #
  # Examples:
  #   # Given following directory structure:
  #   # src/foo.rb
  #   # src/bar.so
  #   # src/foo.yaml
  #   # src/foobar/baz.rb
  #   # src/foobar/README
  #
  #   # requires all files in 'src':
  #   aquire 'src/*'
  #
  #   # requires all files in 'src' recursive:
  #   aquire 'src/**/*'
  #
  #   # require 'src/foo.rb' and 'src/bar.so' and 'src/foobar/baz.rb'
  #   aquire 'src/*', 'src/foobar/*'

  def aquire *globs
    globs.flatten.each do |glob|
      Dir[glob].each do |file|
        require file if file =~ /\.(rb|so)$/
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ramaze-0.1.4 lib/ramaze/snippets/kernel/aquire.rb
ramaze-0.2.0 lib/ramaze/snippets/kernel/aquire.rb
ramaze-0.2.1 lib/ramaze/snippets/kernel/aquire.rb