Sha256: 9891e368666ada343fc7b6044fd1598272106f202496cc715893c4576a578367

Contents?: true

Size: 847 Bytes

Versions: 13

Compression:

Stored size: 847 Bytes

Contents

require 'version'

module AMQP
  module Spec

    # Requires ruby source file(s). Accepts either single filename/glob or Array of filenames/globs.
    # Accepts following options:
    # :*file*:: Lib(s) required relative to this file - defaults to __FILE__
    # :*dir*:: Required lib(s) located under this dir name - defaults to gem name
    #
    def self.require_libs(libs, opts={})
      file = Pathname.new(opts[:file] || __FILE__)
      [libs].flatten.each do |lib|
        name = file.dirname + (opts[:dir] || file.basename('.*')) + lib.gsub(/(?<!.rb)$/, '.rb')
        Pathname.glob(name.to_s).sort.each { |rb| require rb }
      end
    end
  end
end

# Require all ruby source files located under directory lib/amqp-spec
# If you need files in specific order, you should specify it here before the glob
AMQP::Spec.require_libs %W[**/*]

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
amqp-spec-0.2.7 lib/amqp-spec.rb
amqp-spec-0.2.6 lib/amqp-spec.rb
amqp-spec-0.2.5 lib/amqp-spec.rb
amqp-spec-0.2.4 lib/amqp-spec.rb
amqp-spec-0.2.3 lib/amqp-spec.rb
amqp-spec-0.2.1 lib/amqp-spec.rb
amqp-spec-0.2.0 lib/amqp-spec.rb
amqp-spec-0.1.13 lib/amqp-spec.rb
amqp-spec-0.1.12 lib/amqp-spec.rb
amqp-spec-0.1.11 lib/amqp-spec.rb
amqp-spec-0.1.10 lib/amqp-spec.rb
amqp-spec-0.1.8 lib/amqp-spec.rb
amqp-spec-0.1.7 lib/amqp-spec.rb