Class: Noaaish::Translator
- Inherits:
-
Object
- Object
- Noaaish::Translator
- Defined in:
- lib/noaaish/translator.rb
Constant Summary collapse
- ISH_JAVA_COMMAND =
'java -cp %<exe_path>s ishJava < %<input>s > %<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.
9 10 11 12 |
# File 'lib/noaaish/translator.rb', line 9 def initialize(input, output=destination) @input = input @destination = output end |
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
14 15 16 |
# File 'lib/noaaish/translator.rb', line 14 def input @input end |
Instance Method Details
#call ⇒ Object
16 17 18 19 |
# File 'lib/noaaish/translator.rb', line 16 def call system(java_command) destination end |
#destination ⇒ Object
21 22 23 |
# File 'lib/noaaish/translator.rb', line 21 def destination @destination ||= Tempfile.new('noaaish-translator') end |
#ish_java_path ⇒ Object
29 30 31 32 33 34 |
# File 'lib/noaaish/translator.rb', line 29 def ish_java_path Pathname.new(File.dirname(__FILE__)). parent. # lib/ parent + # / "java" end |
#java_command ⇒ Object
25 26 27 |
# File 'lib/noaaish/translator.rb', line 25 def java_command sprintf ISH_JAVA_COMMAND, exe_path: ish_java_path, input: input.path, output: destination.path end |