Module: Tabelr
- Defined in:
- lib/tabelr.rb,
lib/tabelr/table_formater.rb
Defined Under Namespace
Classes: TableFormator
Class Method Summary collapse
Class Method Details
.parse_args ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/tabelr.rb', line 19 def parse_args commands = [] ARGV.each do |arg| commands << arg unless arg.index('-') === 0 end commands end |
.run ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/tabelr.rb', line 7 def run args = parse_args return unless valid? args @tf = TableFormator.new json = JSON.parse(File.read(args[0])) # output = STDOUT output = $stdout @tf.go json, output end |
.valid?(args) ⇒ Boolean
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/tabelr.rb', line 27 def valid? args if args.nil? or args[0].nil? puts "Man, you gotta give me a file to read from!" return end unless File.exist?(args[0]) puts "Man, you gotta give me a valid file to read from!" return end true end |