Class: Noaaish::Translator
- Inherits:
-
Object
- Object
- Noaaish::Translator
- Defined in:
- lib/noaaish/translator.rb
Constant Summary collapse
- ISH_JAVA_COMMAND =
Tail is to not print first line, which is header info
'java -cp %<exe_path>s ishJava < %<input>s | tail -n+2 > %<output>s'.freeze
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
Instance Method Summary collapse
- #call ⇒ Object
- #destination ⇒ Object
-
#initialize(input, output = destination) ⇒ Translator
constructor
A new instance of Translator.
- #ish_java_path ⇒ Object
- #java_command ⇒ Object
Constructor Details
#initialize(input, output = destination) ⇒ Translator
Returns a new instance of Translator.
10 11 12 13 |
# File 'lib/noaaish/translator.rb', line 10 def initialize(input, output=destination) @input = input @destination = output end |
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
15 16 17 |
# File 'lib/noaaish/translator.rb', line 15 def input @input end |
Instance Method Details
#call ⇒ Object
17 18 19 20 |
# File 'lib/noaaish/translator.rb', line 17 def call system(java_command) destination end |
#destination ⇒ Object
22 23 24 |
# File 'lib/noaaish/translator.rb', line 22 def destination @destination ||= Tempfile.new('noaaish-translator') end |
#ish_java_path ⇒ Object
30 31 32 33 34 35 |
# File 'lib/noaaish/translator.rb', line 30 def ish_java_path Pathname.new(File.dirname(__FILE__)). parent. # lib/ parent + # / "java" end |
#java_command ⇒ Object
26 27 28 |
# File 'lib/noaaish/translator.rb', line 26 def java_command sprintf ISH_JAVA_COMMAND, exe_path: ish_java_path, input: input.path, output: destination.path end |