Sha256: abbaccabbb7ed701a59fbe77ba03819e8f0de098dda246a5de210c33d2742d18

Contents?: true

Size: 965 Bytes

Versions: 4

Compression:

Stored size: 965 Bytes

Contents

#          Copyright (c) 2008 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':
  #   acquire 'src/*'
  #
  #   # requires all files in 'src' recursive:
  #   acquire 'src/**/*'
  #
  #   # require 'src/foo.rb' and 'src/bar.so' and 'src/foobar/baz.rb'
  #   acquire 'src/*', 'src/foobar/*'

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

  def aquire *globs
    warn "Kernel#aquire is being deprecated, use Kernel#acquire instead"
    acquire *globs
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ramaze-0.3.0 lib/ramaze/snippets/kernel/acquire.rb
ramaze-0.3.5 lib/ramaze/snippets/kernel/acquire.rb
ramaze-0.3.9 lib/ramaze/snippets/kernel/acquire.rb
ramaze-0.3.9.1 lib/ramaze/snippets/kernel/acquire.rb