Class: Kojo::Commands::FormCmd

Inherits:
CommandBase
  • Object
show all
Defined in:
lib/kojo/commands/form.rb

Overview

Handle calls to the kojo form command

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from CommandBase

#save

Instance Attribute Details

#infileObject (readonly)

Returns the value of attribute infile.



7
8
9
# File 'lib/kojo/commands/form.rb', line 7

def infile
  @infile
end

#outdirObject (readonly)

Returns the value of attribute outdir.



7
8
9
# File 'lib/kojo/commands/form.rb', line 7

def outdir
  @outdir
end

Instance Method Details

#runObject



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/kojo/commands/form.rb', line 21

def run
  infile = args['INFILE']
  outfile = args['--save']
  template = Kojo::Form.new infile

  if outfile
    save outfile, template.render
  else
    puts template.render
  end
end