Sha256: 3820aeadc52257da9895d5c9ddc29f6edfd2d5f38be1a8ed6ebff7b1c3989103

Contents?: true

Size: 771 Bytes

Versions: 10

Compression:

Stored size: 771 Bytes

Contents

module Boson
  # This library loads a gem by the given name. Unlike FileLibrary or ModuleLibrary, this library
  # doesn't need a module to provide its functionality.
  #
  # Example:
  #   >> load_library 'httparty', :class_commands=>{'put'=>'HTTParty.put',
  #      'delete'=>'HTTParty.delete' }
  #   => true
  #   >> put 'http://someurl.com'
  class GemLibrary < Library
    #:stopdoc:
    def self.is_a_gem?(name)
      Object.const_defined?(:Gem) && Gem.searcher.find(name).is_a?(Gem::Specification)
    end

    handles {|source| is_a_gem?(source.to_s) }

    def loaded_correctly?
      !@gems.empty? || !@commands.empty? || !!@module
    end

    def load_source_and_set_module
      detect_additions { Util.safe_require @name }
    end
    #:startdoc:
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
boson-0.3.3 lib/boson/libraries/gem_library.rb
boson-0.3.2 lib/boson/libraries/gem_library.rb
boson-0.3.1 lib/boson/libraries/gem_library.rb
boson-0.3.0 lib/boson/libraries/gem_library.rb
boson-0.2.5 lib/boson/libraries/gem_library.rb
boson-0.2.4 lib/boson/libraries/gem_library.rb
boson-0.2.3 lib/boson/libraries/gem_library.rb
boson-0.2.2 lib/boson/libraries/gem_library.rb
boson-0.2.1 lib/boson/libraries/gem_library.rb
boson-0.2.0 lib/boson/libraries/gem_library.rb