Slide 48
Slide 48 text
The Command class and
Its Instances
class Command < Struct.new(:min_string, :max_string, :action); end
def commands
@commands_ ||= [
Command.new('a', 'avail_nets', -> (*_options) { cmd_a }),
Command.new('ci', 'ci', -> (*_options) { cmd_ci }),
Command.new('co', 'connect', -> (*options) { cmd_co(*options) }),
Command.new('cy', 'cycle', -> (*_options) { cmd_cy }),
Command.new('d', 'disconnect', -> (*_options) { cmd_d }),
Command.new('f', 'forget', -> (*options) { cmd_f(*options) }),
Command.new('h', 'help', -> (*_options) { cmd_h }),
Command.new('i', 'info', -> (*_options) { cmd_i }),
Command.new('l', 'ls_avail_nets', -> (*_options) { cmd_l }),
Command.new('na', 'nameservers', -> (*options) { cmd_na(*options) }),
Command.new('ne', 'network_name', -> (*_options) { cmd_ne }),
Command.new('of', 'off', -> (*_options) { cmd_of }),
Command.new('on', 'on', -> (*_options) { cmd_on }),
Command.new('ro', 'ropen', -> (*options) { cmd_ro(*options) }),
Command.new('pa', 'password', -> (*options) { cmd_pa(*options) }),
Command.new('pr', 'pref_nets', -> (*_options) { cmd_pr }),
Command.new('q', 'quit', -> (*_options) { cmd_q }),
Command.new('t', 'till', -> (*options) { cmd_t(*options) }),
Command.new('w', 'wifi_on', -> (*_options) { cmd_w }),
Command.new('x', 'xit', -> (*_options) { cmd_x })