Class: JsonToErb::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/jsontoerb/cli.rb

Class Method Summary collapse

Class Method Details

.start(*args) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/jsontoerb/cli.rb', line 4

def self.start(*args)
  if args.length == 2
    if !File.exist?(args[0])
      puts "Template does not exist"
      return
    end
    template_file = File.open(args[0], "rb")
    json = args[1]
    output = JsonToErb.render_template(template_file.read, json)
    puts output
    template_file.close
  end
end