Module: CommandKit::Help::Man::ClassMethods

Defined in:
lib/command_kit/help/man.rb

Overview

Class-level methods.

Instance Method Summary collapse

Instance Method Details

#man_dir(new_man_dir = nil) ⇒ String?

Gets or sets the directory where man-pages are stored.

Examples:

man_dir "#{__dir__}/../../man"

Parameters:

  • new_man_dir (String, nil) (defaults to: nil)

    If a String is given, it will set The class'es man-page directory.

Returns:

  • (String, nil)

    The class'es or superclass'es man-page directory.



71
72
73
74
75
76
77
78
79
# File 'lib/command_kit/help/man.rb', line 71

def man_dir(new_man_dir=nil)
  if new_man_dir
    @man_dir = File.expand_path(new_man_dir)
  else
    @man_dir || if superclass.kind_of?(ClassMethods)
                  superclass.man_dir
                end
  end
end

#man_page(new_man_page = nil) ⇒ String

Gets or sets the class'es man-page file name.

Parameters:

  • new_man_page (String, nil) (defaults to: nil)

    If a String is given, the class'es man-page file name will be set.

Returns:

  • (String)

    The class'es or superclass'es man-page file name.



92
93
94
95
96
97
98
# File 'lib/command_kit/help/man.rb', line 92

def man_page(new_man_page=nil)
  if new_man_page
    @man_page = new_man_page
  else
    @man_page || "#{command_name}.1"
  end
end