Method: Commonmeta::CLI#convert

Defined in:
lib/commonmeta/cli.rb

#convert(input) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/commonmeta/cli.rb', line 39

def convert(input)
   = .new(input: input,
                          from: options[:from],
                          regenerate: options[:regenerate],
                          style: options[:style],
                          locale: options[:locale],
                          show_errors: options[:show_errors],
                          doi: options[:doi],
                          depositor: options[:depositor],
                          email: options[:email],
                          registrant: options[:registrant])
  to = options[:to] || "schema_org"

  if options[:show_errors] && !.valid?
    warn .errors
  else
    puts .send(to)
  end
end