Class: Bors::CommandLine
- Inherits:
-
Object
show all
- Defined in:
- lib/bors/command_line.rb
Instance Method Summary
collapse
Constructor Details
#initialize(options) ⇒ CommandLine
Returns a new instance of CommandLine.
4
5
6
|
# File 'lib/bors/command_line.rb', line 4
def initialize(options)
@options = options
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
33
34
35
|
# File 'lib/bors/command_line.rb', line 33
def method_missing(m, *args, &block)
@options[m.to_sym] ? "--#{m.to_s} #{@options[m.to_sym]}" : nil
end
|
Instance Method Details
#create_cache ⇒ Object
16
17
18
|
# File 'lib/bors/command_line.rb', line 16
def create_cache
@options[:create_cache] == true ? "-c" : nil
end
|
#examples ⇒ Object
12
13
14
|
# File 'lib/bors/command_line.rb', line 12
def examples
@options[:examples]
end
|
#run! ⇒ Object
24
25
26
27
28
29
|
# File 'lib/bors/command_line.rb', line 24
def run!
puts "VW Command: #{to_s}"
stdout_str, stderr_str, status = Open3.capture3(to_s)
raise Exceptions::VWCommandLineError.new(stderr_str) if status.success? == false
stdout_str
end
|
#to_s ⇒ Object
8
9
10
|
# File 'lib/bors/command_line.rb', line 8
def to_s
"vw --data #{examples} #{training_mode} #{cache_file} #{create_cache} #{passes} #{initial_regressor} #{bit_precision} #{quadratic} #{ngram} #{final_regressor} #{predictions} #{min_prediction} #{max_prediction} #{loss_function}".squeeze(' ')
end
|
#training_mode ⇒ Object
20
21
22
|
# File 'lib/bors/command_line.rb', line 20
def training_mode
@options[:training_mode] == true ? "-t" : nil
end
|