Class: Six::Arma::Tools::CfgConvert
- Inherits:
-
Object
- Object
- Six::Arma::Tools::CfgConvert
- Defined in:
- lib/six/arma/tools/cfgconvert.rb
Constant Summary collapse
- TOOL =
TODO: Add to configuration file
"CfgConvert.exe"
Instance Attribute Summary collapse
-
#destination ⇒ Object
allows instance.attribute to be read and written (e.g convert.destination).
-
#source ⇒ Object
readonly
allows instance.attribute to be read (e.g convert.source).
Instance Method Summary collapse
- #bin ⇒ Object
- #exec(cmd) ⇒ Object
-
#initialize(source, destination = nil) ⇒ CfgConvert
constructor
cfgConvert [-bin | -txt | -xml] <destination>] <source>.
- #txt ⇒ Object
- #xml ⇒ Object
Constructor Details
#initialize(source, destination = nil) ⇒ CfgConvert
cfgConvert [-bin | -txt | -xml] <destination>] <source>
11 12 13 14 |
# File 'lib/six/arma/tools/cfgconvert.rb', line 11 def initialize(source, destination = nil) @source = source @destination = destination end |
Instance Attribute Details
#destination ⇒ Object
allows instance.attribute to be read and written (e.g convert.destination)
8 9 10 |
# File 'lib/six/arma/tools/cfgconvert.rb', line 8 def destination @destination end |
#source ⇒ Object (readonly)
allows instance.attribute to be read (e.g convert.source)
7 8 9 |
# File 'lib/six/arma/tools/cfgconvert.rb', line 7 def source @source end |
Instance Method Details
#bin ⇒ Object
16 17 18 |
# File 'lib/six/arma/tools/cfgconvert.rb', line 16 def bin exec("bin") end |
#exec(cmd) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/six/arma/tools/cfgconvert.rb', line 28 def exec(cmd) extension = "#{cmd}" cmd += " -dst #{@destination}" if @destination # TODO: Handle exceptions, maybe with FileTest system "#{TOOL} -#{cmd} #{@source}" "#{source[/\A.*\./]}#{extension}" # return the predicted output file end |
#txt ⇒ Object
20 21 22 |
# File 'lib/six/arma/tools/cfgconvert.rb', line 20 def txt exec("txt") end |
#xml ⇒ Object
24 25 26 |
# File 'lib/six/arma/tools/cfgconvert.rb', line 24 def xml exec("xml") end |