Class: Boson::GemLibrary
- Defined in:
- lib/boson/libraries/gem_library.rb
Overview
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'
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Library
Attributes included from Library::NamespaceLoader
#indexed_namespace, #object_namespace
Attributes included from Library::Namespacer
Attributes included from Library::Libraries
Attributes included from Library::Alias
#class_commands, #no_alias_creation
Attributes included from Library::Save
Class Method Summary collapse
-
.is_a_gem?(name) ⇒ Boolean
:stopdoc:.
Instance Method Summary collapse
Methods included from Library::NamespaceLoader
#actual_load_commands, #clean_library_commands, #handle_method_conflict_error, #method_conflicts, #set_library_commands
Methods included from Library::Namespacer
Methods included from Library::LibrariesLoader
#after_include, #before_load_commands, #detect_additions, #module_callbacks
Methods included from Library::Libraries
Methods included from Library::AliasLoader
#before_load_commands, #load_commands?
Methods included from Library::Save
#before_initialize, #config, #marshal_dump, #marshal_load, #set_repo
Class Method Details
.is_a_gem?(name) ⇒ Boolean
:stopdoc:
12 13 14 15 16 17 |
# File 'lib/boson/libraries/gem_library.rb', line 12 def self.is_a_gem?(name) return false unless defined? Gem Gem::VERSION >= '1.8.0' ? Gem::Specification.find_all_by_name(name)[0].is_a?(Gem::Specification) : Gem.searcher.find(name).is_a?(Gem::Specification) end |
Instance Method Details
#load_source_and_set_module ⇒ Object
25 26 27 |
# File 'lib/boson/libraries/gem_library.rb', line 25 def load_source_and_set_module detect_additions { Util.safe_require @name } end |
#loaded_correctly? ⇒ Boolean
21 22 23 |
# File 'lib/boson/libraries/gem_library.rb', line 21 def loaded_correctly? !@gems.empty? || !@commands.empty? || !!@module end |