Class: MiniTransformer::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/mini_transformer/cli.rb

Instance Method Summary collapse

Instance Method Details

#transform(json, xml, output = nil, format = "html", mapping = nil) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/mini_transformer/cli.rb', line 6

def transform(json, xml, output=nil, format="html", mapping=nil)
  if output.nil?
    output = "#{Dir.pwd}/test.html"
  end

  @parser = MiniTransformer::Parser.new
  @parser.setup(json, xml, output, format, mapping)
  @parser.validate
  @parser.parse

  if format == "json"
    @parser.to_json
  else
    @parser.to_html
  end
  
end

#versionObject



26
27
28
29
30
# File 'lib/mini_transformer/cli.rb', line 26

def version
  puts "Mini Transform version #{MiniTransformer::VERSION}"
  "Mini Transform version #{MiniTransformer::VERSION}"
  #Bundler.ui.info "Bundler version #{Bundler::VERSION}"
end