Class: RDoc::RubygemsHook

Inherits:
Object
  • Object
show all
Defined in:
lib/rdoc/rubygems_hook.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(spec, generate_rdoc = false, generate_ri = true) ⇒ RubygemsHook

Returns a new instance of RubygemsHook.



280
281
282
283
284
# File 'lib/rdoc/rubygems_hook.rb', line 280

def initialize(spec, generate_rdoc = false, generate_ri = true)
  @spec = spec
  @generate_rdoc = generate_rdoc
  @generate_ri   = generate_ri
end

Instance Attribute Details

#generate_rdocObject

Returns the value of attribute generate_rdoc.



274
275
276
# File 'lib/rdoc/rubygems_hook.rb', line 274

def generate_rdoc
  @generate_rdoc
end

#generate_riObject

Returns the value of attribute generate_ri.



274
275
276
# File 'lib/rdoc/rubygems_hook.rb', line 274

def generate_ri
  @generate_ri
end

Class Method Details

.default_gem?Boolean

Returns:

  • (Boolean)


276
277
278
# File 'lib/rdoc/rubygems_hook.rb', line 276

def self.default_gem?
  !File.exist?(File.join(__dir__, "..", "rubygems_plugin.rb"))
end

.generation_hook(installer, specs) ⇒ Object



303
304
305
306
307
308
309
# File 'lib/rdoc/rubygems_hook.rb', line 303

def self.generation_hook installer, specs
  # Do nothing if this is NOT a default gem.
  return unless default_gem?

  # Generate document for compatibility if this is a default gem.
  RubyGemsHook.generate(installer, specs)
end

Instance Method Details

#generateObject



286
287
288
289
290
291
292
# File 'lib/rdoc/rubygems_hook.rb', line 286

def generate
  # Do nothing if this is NOT a default gem.
  return unless self.class.default_gem?

  # Generate document for compatibility if this is a default gem.
  RubyGemsHook.new(@spec, @generate_rdoc, @generate_ri).generate
end

#removeObject



294
295
296
297
298
299
300
301
# File 'lib/rdoc/rubygems_hook.rb', line 294

def remove
  # Do nothing if this is NOT a default gem.
  return unless self.class.default_gem?

  # Remove generated document for compatibility if this is a
  # default gem.
  RubyGemsHook.new(@spec).remove
end