Sha256: 29a8b08fbd28e4b003b60bb66c3ae73a5b41cb6a344871933868a168d304ce92
Contents?: true
Size: 1.19 KB
Versions: 21
Compression:
Stored size: 1.19 KB
Contents
module Relish module Command module Dsl class HelpText class << self attr_accessor :current_command, :next_usage, :next_description def add(name, command) self.current_command = name commands[command] = [] unless commands.key?(command) commands[command].push(get_next_usage => get_next_description) reset_accessors end def get_next_usage next_usage or current_command.to_s end def get_next_description next_description || raise( "please set a description for #{current_command.inspect}" ) end def commands @commands ||= {} end def reset_accessors self.current_command = self.next_usage = self.next_description = nil end def clear_commands @commands = {} end def max_usage_length commands.values.map {|v| v.map {|v| v.keys.to_s.length }.max }.max end end end end end end
Version data entries
21 entries across 21 versions & 1 rubygems