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_argsObject



18
19
20
21
22
23
24
# File 'lib/tabelr.rb', line 18

def parse_args
  commands = []
  ARGV.each do |arg|
    commands << arg unless arg.index('-') === 0
  end
  commands
end

.runObject



7
8
9
10
11
12
13
14
15
16
# File 'lib/tabelr.rb', line 7

def run
  args = parse_args
  @tf = TableFormator.new

  json = JSON.parse(File.read(args[0]))
  output = STDOUT
  output = File.open(args[1], 'w') unless args[1].nil?

  @tf.go json, output
end