Class: Rbkb::Cli::Chars

Inherits:
Executable show all
Defined in:
lib/rbkb/cli/chars.rb

Overview

Copyright 2009 emonti at matasano.com See README.rdoc for license information

Repeats an argument N times

Instance Attribute Summary

Attributes inherited from Executable

#argv, #exit_status, #oparse, #opts, #stderr, #stdin, #stdout

Instance Method Summary collapse

Methods inherited from Executable

#bail, #bail_args, #exit, #initialize, run

Constructor Details

This class inherits a constructor from Rbkb::Cli::Executable

Instance Method Details

#go(*args) ⇒ Object



18
19
20
21
22
# File 'lib/rbkb/cli/chars.rb', line 18

def go(*args)
  super(*args)
  @stdout << @argv[1] * @argv[0].to_i
  self.exit(0)
end

#make_parserObject



8
9
10
11
# File 'lib/rbkb/cli/chars.rb', line 8

def make_parser
  super()
  @oparse.banner += " 100 A; # print 100 A's"
end

#parse(*args) ⇒ Object



13
14
15
16
# File 'lib/rbkb/cli/chars.rb', line 13

def parse(*args)
  super(*args)
  bail_args @argv.join(' ') unless @argv.size == 2
end