Sha256: 93b1442539230e940fd5b3e58c00423db689ea20efb1a1026d28db9ab53b0667

Contents?: true

Size: 953 Bytes

Versions: 1

Compression:

Stored size: 953 Bytes

Contents

module Zemax
  require 'pathname'

  VERSION_FILE = Pathname.new(__FILE__).dirname + '../VERSION'   # :nodoc:
  VERSION = VERSION_FILE.exist? ? VERSION_FILE.read.strip : nil

  # 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  # module Zemax

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zemax-2.3.4.bui2 lib/zemax.rb