class Command
Attributes
desc[R]
examples[RW]
help[RW]
name[R]
nodes[RW]
Public Class Methods
new(name, desc, nodes:[], examples:nil)
click to toggle source
Create a new command @param name [String] command name used on command line @param desc [String] the command's description @param nodes [String] the command's description @param examples [String] the command's examples
# File lib/nub/commander.rb, line 113 def initialize(name, desc, nodes:[], examples:nil) @name = name @desc = desc @nodes = nodes @examples = examples @help = "" end
Public Instance Methods
to_s(level:0)
click to toggle source
Return a human readable string of this object @param level [Integer] level to indent
# File lib/nub/commander.rb, line 129 def to_s(level:0) str = "#{" " * level * 2}Command => name:#{@name}, desc:'#{@desc}'" @nodes.each{|x| str += "\n#{x.to_s(level: level + 1)}" } return str end
to_sym()
click to toggle source
Get a symbol representing the command @returns symbol
# File lib/nub/commander.rb, line 123 def to_sym return @name.gsub('-', '_').to_sym end