Class: Spandx::Python::Index

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/spandx/python/index.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(directory:) ⇒ Index

Returns a new instance of Index.



10
11
12
13
14
15
16
# File 'lib/spandx/python/index.rb', line 10

def initialize(directory:)
  @directory = directory
  @name = 'pypi'
  @source = 'https://pypi.org'
  @pypi = Pypi.new
  @cache = ::Spandx::Core::Cache.new(@name, root: directory)
end

Instance Attribute Details

#directoryObject (readonly)

Returns the value of attribute directory.



8
9
10
# File 'lib/spandx/python/index.rb', line 8

def directory
  @directory
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/spandx/python/index.rb', line 8

def name
  @name
end

#pypiObject (readonly)

Returns the value of attribute pypi.



8
9
10
# File 'lib/spandx/python/index.rb', line 8

def pypi
  @pypi
end

#sourceObject (readonly)

Returns the value of attribute source.



8
9
10
# File 'lib/spandx/python/index.rb', line 8

def source
  @source
end

Instance Method Details

#update!Object



18
19
20
21
22
# File 'lib/spandx/python/index.rb', line 18

def update!(*)
  queue = Queue.new
  [fetch(queue), save(queue)].each(&:join)
  cache.rebuild_index
end