Class: Rootage::Help

Inherits:
Object
  • Object
show all
Defined in:
lib/rootage/help.rb

Direct Known Subclasses

MarkdownHelp, TextHelp

Constant Summary collapse

FORMAT =

Known format table.

{}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cmd) ⇒ Help

Returns a new instance of Help.

Parameters:

  • command (Command)

    object that has this help



31
32
33
# File 'lib/rootage/help.rb', line 31

def initialize(cmd)
  @cmd = cmd
end

Instance Attribute Details

#cmdObject (readonly)

Returns the value of attribute cmd.



27
28
29
# File 'lib/rootage/help.rb', line 27

def cmd
  @cmd
end

Class Method Details

.find(format) ⇒ Class

Find the named format.

Parameters:

  • format (Symbol)

    format name

Returns:

  • (Class)

    help class



23
24
25
# File 'lib/rootage/help.rb', line 23

def self.find(format)
  Help::FORMAT[format]
end

.register(name, klass = self) ⇒ void

This method returns an undefined value.

Register the help format. This is for subclasses.

Parameters:

  • name (Symbol)

    format name

  • klass (Class) (defaults to: self)

    help class



13
14
15
# File 'lib/rootage/help.rb', line 13

def self.register(name, klass=self)
  Help::FORMAT[name] = klass
end