Class: Termium::Cli
- Inherits:
-
Thor
show all
- Defined in:
- lib/termium/cli.rb
Overview
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args) ⇒ Object
70
71
72
73
74
|
# File 'lib/termium/cli.rb', line 70
def method_missing(*args)
warn "No method found named: #{args[0]}"
warn "Run with `--help` or `-h` to see available options"
exit 1
end
|
Class Method Details
.exit_on_failure? ⇒ Boolean
80
81
82
|
# File 'lib/termium/cli.rb', line 80
def self.exit_on_failure?
true
end
|
Instance Method Details
#convert ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/termium/cli.rb', line 46
def convert
input_path = input_file_as_path(options[:input_file])
puts "Reading TERMIUM export file: #{input_path.relative_path_from(Dir.pwd)}"
= Termium::Extract.from_xml(File.read(input_path.expand_path))
puts "Size of TERMIUM dataset: #{.core.size}"
puts "Converting to Glossarist..."
convert_options = {}
if options[:date_accepted]
convert_options[:date_accepted] =
Date.parse(options[:date_accepted]).iso8601
end
glossarist_col = .to_concept(convert_options)
output_path = output_dir_as_path(options[:output_file], input_path)
puts "Writing Glossarist dataset to: #{output_path.relative_path_from(Dir.pwd)}"
glossarist_col.save_to_files(output_path.expand_path)
puts "Done."
exit 0
end
|
#respond_to_missing? ⇒ Boolean
76
77
78
|
# File 'lib/termium/cli.rb', line 76
def respond_to_missing?
true
end
|