# Terse Ruby
# A simple utility to allow you to write shorthand for Ruby classes; the utility will then convert this shorthand file into a genuine Ruby .rb file (either writing a new file or overwriting)
#
# E.g. terse_file.txt contains :
#
# req a_gem
# c AClass
# i AnInclude
# d method1
#
# Then Terse Ruby will write a new file terse_file.rb containing :
#
# require "a_gem"
# class AClass
# include AnInclude
# def method1
# end
# end
#
#
# Rules :
# Terse Ruby will look through the supplied files and convert certain keywords at the start of lines :
# c -> class
# m -> module
# r -> require (and will wrap the required item in " " if needed)
# i -> include
# d -> def
# e -> end (method, class & module ends will be added if a subsequent method, class or module is detected, or is end-of-file)
# a -> attr_accessor (and prefixes the variable name with : to make it a symbol)
# r -> attr_reader (and prefixes the variable name with : to make it a symbol)
# w -> attr_writer (and prefixes the variable name with : to make it a symbol)
#
# All remaining text in the line is not altered, even if a matching keyword is present, because the keywords need to be at the beginning of the line (ignoring leading whitespace)
#
#
# Flags :
# v : verbose mode
# o : overwrite - if the new file already exists, the existing file will be overwritten
#
#
# Invokation :
# terse_ruby can be directly invoked from the command-line with :
#
# ruby -e "require 'terse_ruby'; TerseRuby.scan_files ARGV" [one or more files] [flags]
#
# e.g.
#
# ruby -e "require 'terse_ruby'; TerseRuby.scan_files ARGV" terse_file1.txt terse_file2.txt -o -v
#
# Alternatively, the below two lines are all you need to run terse_ruby within your own Ruby file :
#
# require_relative "../lib/terse_ruby"
# TerseRuby.scan_files ARGV
#
# (if ARGV have not been supplied, you'll need to construct this object yourself first)
# A simple utility to allow you to write shorthand for Ruby classes; the utility will then convert this shorthand file into a genuine Ruby .rb file (either writing a new file or overwriting)
#
# E.g. terse_file.txt contains :
#
# req a_gem
# c AClass
# i AnInclude
# d method1
#
# Then Terse Ruby will write a new file terse_file.rb containing :
#
# require "a_gem"
# class AClass
# include AnInclude
# def method1
# end
# end
#
#
# Rules :
# Terse Ruby will look through the supplied files and convert certain keywords at the start of lines :
# c -> class
# m -> module
# r -> require (and will wrap the required item in " " if needed)
# i -> include
# d -> def
# e -> end (method, class & module ends will be added if a subsequent method, class or module is detected, or is end-of-file)
# a -> attr_accessor (and prefixes the variable name with : to make it a symbol)
# r -> attr_reader (and prefixes the variable name with : to make it a symbol)
# w -> attr_writer (and prefixes the variable name with : to make it a symbol)
#
# All remaining text in the line is not altered, even if a matching keyword is present, because the keywords need to be at the beginning of the line (ignoring leading whitespace)
#
#
# Flags :
# v : verbose mode
# o : overwrite - if the new file already exists, the existing file will be overwritten
#
#
# Invokation :
# terse_ruby can be directly invoked from the command-line with :
#
# ruby -e "require 'terse_ruby'; TerseRuby.scan_files ARGV" [one or more files] [flags]
#
# e.g.
#
# ruby -e "require 'terse_ruby'; TerseRuby.scan_files ARGV" terse_file1.txt terse_file2.txt -o -v
#
# Alternatively, the below two lines are all you need to run terse_ruby within your own Ruby file :
#
# require_relative "../lib/terse_ruby"
# TerseRuby.scan_files ARGV
#
# (if ARGV have not been supplied, you'll need to construct this object yourself first)