module HaveAPI::Fs::Help::InstanceMethods

Protected Instance Methods

help_contents() click to toggle source

List of help files in all formats as strings. @return [Array<String>]

# File lib/haveapi/fs/help.rb, line 41
def help_contents
  help_files.map(&:to_s)
end
help_file(name) click to toggle source

@return [Components::HelpFile] the recipe for a subclass, as

{Component#new_child}
# File lib/haveapi/fs/help.rb, line 53
def help_file(name)
  format = name.to_s.split('.').last.to_sym

  case format
  when :html
    [Components::HtmlHelpFile, self, format]

  when :txt, :md
    [Components::MdHelpFile, self, :md]

  when :man
    [Components::GroffHelpFile, self, :md]

  else
    return nil
  end
end
help_file?(name) click to toggle source

Check if `name` is a help file. @param [Symbol] name

# File lib/haveapi/fs/help.rb, line 47
def help_file?(name)
  help_files.include?(name)
end
help_files() click to toggle source

List of help files in all formats as symbols. @return [Array<Symbol>]

# File lib/haveapi/fs/help.rb, line 35
def help_files
  %i(html txt md man).map { |v| :"help.#{v}" }
end