Sha256: f5206d93102cb07134d78f91a36eb13df5d72c623e38bc6d6e995b745dbc04a2
Contents?: true
Size: 562 Bytes
Versions: 2
Compression:
Stored size: 562 Bytes
Contents
module MyScripts class Script # Base class for all scripts def initialize( name, argv, cli ) @name = name @argv = argv @cli = cli end def puts *args @cli.stdout.puts *args end def usage examples, explanation = nil puts "Usage:" puts (examples.respond_to?(:split) ? examples.split("\n") : examples).map {|line| " #{@name} #{line}"} puts explanation if explanation exit 1 end def to_s "#{@name} #{@argv.join(' ')} -> #{self.class}" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
my_scripts-0.0.7 | lib/my_scripts/script.rb |
my_scripts-0.0.6 | lib/my_scripts/script.rb |