Class: Gem::GemPathList
- Inherits:
-
Array
- Object
- Array
- Gem::GemPathList
- Defined in:
- lib/rdi/Plugins/GemCommon.rb
Instance Method Summary collapse
-
#<<(iDirName) ⇒ Object
Add a path to the list.
-
#clear_paths ⇒ Object
Clear the paths.
-
#clearCache ⇒ Object
Clear the cache.
-
#getLibDirs ⇒ Object
Get the list of lib directories accessible through the paths.
Instance Method Details
#<<(iDirName) ⇒ Object
Add a path to the list
Parameters:
-
iDirName (String): Directory to add to the list
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rdi/Plugins/GemCommon.rb', line 14 def <<(iDirName) # Add the path for real in the internals super # Add the lib directory if it is already initialized if ((defined?(@LibDirs) != nil) and (@LibDirs != nil)) Dir.glob("#{iDirName}/gems/*").each do |iGemDirName| if (File.exists?("#{iGemDirName}/lib")) @LibDirs << iGemDirName end end end # Add the path in RubyGems Gem.path_ORG << iDirName end |
#clear_paths ⇒ Object
Clear the paths
52 53 54 55 56 57 |
# File 'lib/rdi/Plugins/GemCommon.rb', line 52 def clear_paths Gem.clear_paths_ORG # Reset our cache with the new paths replace(Gem.path_ORG) @LibDirs = nil end |
#clearCache ⇒ Object
Clear the cache
60 61 62 |
# File 'lib/rdi/Plugins/GemCommon.rb', line 60 def clearCache @LibDirs = nil end |
#getLibDirs ⇒ Object
Get the list of lib directories accessible through the paths
Return:
-
list<String>: List of paths
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rdi/Plugins/GemCommon.rb', line 34 def getLibDirs if ((defined?(@LibDirs) == nil) or (@LibDirs == nil)) # Create it @LibDirs = [] each do |iGemsDirName| Dir.glob("#{iGemsDirName}/gems/*").each do |iGemDirName| if (File.exists?("#{iGemDirName}/lib")) @LibDirs << iGemDirName end end end end return @LibDirs end |