Class: Gem::Specification

Inherits:
Object
  • Object
show all
Defined in:
lib/rubygems/gem/specification.rb

Instance Method Summary collapse

Instance Method Details

#has_manpage?(section = nil) ⇒ Boolean

Does this specification include a manpage?

Returns:

  • (Boolean)


13
14
15
# File 'lib/rubygems/gem/specification.rb', line 13

def has_manpage?(section = nil)
  File.directory?(man_dir) && manpages(section).any?
end

#man_dirObject

Returns the full path to installed gem’s manual directory.



6
7
8
# File 'lib/rubygems/gem/specification.rb', line 6

def man_dir
  @man_dir ||= File.join(respond_to?(:gem_dir) ? gem_dir : full_gem_path, 'man')
end

#manpages(section = nil) ⇒ Object

Paths to the manpages included in this gem.



20
21
22
23
24
# File 'lib/rubygems/gem/specification.rb', line 20

def manpages(section = nil)
  Dir.entries(man_dir).select do |file|
    file =~ /(.+).#{section || '\d'}$/
  end
end