Class: MDQT::CLI::Transform

Inherits:
Base
  • Object
show all
Defined in:
lib/mdqt/cli/transform.rb

Constant Summary collapse

IdentifierUtils =
MDQT::Client::IdentifierUtils

Instance Method Summary collapse

Methods inherited from Base

#advise_on_xml_signing_support, #args, #btw, check_requirements, #colour_shell?, #explain, #extract_certificate_paths, #get_stdin, #halt!, #hey, #initialize, introduce, #options, #options=, #output, #pastel, #pipeable?, run, #say, #service_url, service_url, #yay

Constructor Details

This class inherits a constructor from MDQT::CLI::Base

Instance Method Details

#runObject



11
12
13
14
15
16
17
18
19
# File 'lib/mdqt/cli/transform.rb', line 11

def run

  halt!("No entityIDs have been specified!") if args.empty?

  args.each do |arg|
    puts transform(arg)
  end

end

#transform(arg) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/mdqt/cli/transform.rb', line 21

def transform(arg)
  arg = arg.strip
  return arg if IdentifierUtils.valid_transformed?(arg)
  return IdentifierUtils.correct_lazy_transformed(arg) if IdentifierUtils.lazy_transformed?(arg)
  return IdentifierUtils.correct_fish_transformed(arg) if IdentifierUtils.fish_transformed?(arg)
  IdentifierUtils.transform_uri(arg)
end