Class: GroongaQueryLog::CommandVersionCompatibilityChecker::Options
- Inherits:
-
Object
- Object
- GroongaQueryLog::CommandVersionCompatibilityChecker::Options
- Defined in:
- lib/groonga-query-log/command-version-compatibility-checker.rb
Instance Attribute Summary collapse
-
#output_path ⇒ Object
Returns the value of attribute output_path.
-
#target_version ⇒ Object
Returns the value of attribute target_version.
Instance Method Summary collapse
- #create_incompatibility_detector ⇒ Object
- #create_output(&block) ⇒ Object
-
#initialize ⇒ Options
constructor
A new instance of Options.
Constructor Details
#initialize ⇒ Options
Returns a new instance of Options.
72 73 74 75 |
# File 'lib/groonga-query-log/command-version-compatibility-checker.rb', line 72 def initialize @target_version = 2 @output_path = nil end |
Instance Attribute Details
#output_path ⇒ Object
Returns the value of attribute output_path.
71 72 73 |
# File 'lib/groonga-query-log/command-version-compatibility-checker.rb', line 71 def output_path @output_path end |
#target_version ⇒ Object
Returns the value of attribute target_version.
70 71 72 |
# File 'lib/groonga-query-log/command-version-compatibility-checker.rb', line 70 def target_version @target_version end |
Instance Method Details
#create_incompatibility_detector ⇒ Object
77 78 79 80 81 82 83 84 85 86 |
# File 'lib/groonga-query-log/command-version-compatibility-checker.rb', line 77 def create_incompatibility_detector case @target_version when 1 IncompatibilityDetector::Version1.new when 2 IncompatibilityDetector::Version2.new else raise ArgumentError, "Unsupported version: #{@target_version}" end end |
#create_output(&block) ⇒ Object
88 89 90 91 92 93 94 95 |
# File 'lib/groonga-query-log/command-version-compatibility-checker.rb', line 88 def create_output(&block) if @output_path FileUtils.mkdir_p(File.dirname(@output_path)) File.open(@output_path, "w", &block) else yield($stdout) end end |