Class: Spandx::Ruby::Index

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/spandx/ruby/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
# File 'lib/spandx/ruby/index.rb', line 10

def initialize(directory:)
  @directory = directory
  @name = 'rubygems'
  @cache = ::Spandx::Core::Cache.new(@name, root: directory)
  @rubygems = ::Spandx::Ruby::Gateway.new
end

Instance Attribute Details

#directoryObject (readonly)

Returns the value of attribute directory.



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

def directory
  @directory
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#rubygemsObject (readonly)

Returns the value of attribute rubygems.



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

def rubygems
  @rubygems
end

Instance Method Details

#update!Object



17
18
19
20
21
# File 'lib/spandx/ruby/index.rb', line 17

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