Class: Rbkb::Cli::D64

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

Overview

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

d64 converts a base-64 encoded string back to its orginal form.

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



22
23
24
25
26
# File 'lib/rbkb/cli/d64.rb', line 22

def go(*args)
  super(*args)
  @stdout << @opts[:indat].d64
  self.exit(0)
end

#make_parserObject



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

def make_parser
  super()
  @oparse.banner += " <data | blank for stdin>"
  add_std_file_opt(:indat)
end

#parse(*args) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/rbkb/cli/d64.rb', line 14

def parse(*args)
  super(*args)
  parse_string_argument(:indat)
  parse_file_argument(:indat)
  parse_catchall()
  @opts[:indat] ||= @stdin.read
end