Sha256: ccc72832aa01f3ba59acf637fb76b3d9316f99580af85cbd7f5e67192a58edea

Contents?: true

Size: 745 Bytes

Versions: 14

Compression:

Stored size: 745 Bytes

Contents

# This library requires the given name. This is useful for loading standard libraries,
# non-gem libraries (i.e. rip packages) and anything else in $LOAD_PATH.
#
# Example:
#   >> load_library 'fileutils', :class_commands=>{'cd'=>'FileUtils.cd', 'cp'=>'FileUtils.cp'}
#   => true
#   >> cd '/home'
#   => 0
#   >> Dir.pwd
#   >> '/home'
class Boson::RequireLibrary < Boson::GemLibrary
  EXTENSIONS = ['', '.rb', '.rbw', '.so', '.bundle', '.dll', '.sl', '.jar']
  handles {|source|
    extensions_glob = "{#{EXTENSIONS.join(',')}}"
    ($LOAD_PATH - ['.']).any? {|dir|
      Dir["#{File.expand_path source.to_s, dir}#{extensions_glob}"].size > 0
    }
  }

  def loaded_correctly?
    super || $".grep(/^#{@name}\.([a-z]+)?$/).size > 0
  end
end

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
boson-more-0.3.1 lib/boson/libraries/require_library.rb
boson-more-0.3.0 lib/boson/libraries/require_library.rb
boson-more-0.2.2 lib/boson/libraries/require_library.rb
boson-more-0.2.1 lib/boson/libraries/require_library.rb
boson-more-0.2.0 lib/boson/libraries/require_library.rb
boson-more-0.1.0 lib/boson/libraries/require_library.rb
boson-0.4.0 lib/boson/libraries/require_library.rb
bosonson-0.304.3 lib/boson/libraries/require_library.rb
bosonson-0.304.2 lib/boson/libraries/require_library.rb
bosonson-0.304.1 lib/boson/libraries/require_library.rb
boson-0.3.4 lib/boson/libraries/require_library.rb
boson-0.3.3 lib/boson/libraries/require_library.rb
boson-0.3.2 lib/boson/libraries/require_library.rb
boson-0.3.1 lib/boson/libraries/require_library.rb