Class: Groonga::Command::Parser::Command::GroongaCommandConvertFormat
- Inherits:
-
Object
- Object
- Groonga::Command::Parser::Command::GroongaCommandConvertFormat
- Defined in:
- lib/groonga/command/parser/command/groonga-command-convert-format.rb
Instance Method Summary collapse
-
#initialize ⇒ GroongaCommandConvertFormat
constructor
A new instance of GroongaCommandConvertFormat.
- #run(argv = ARGV) ⇒ Object
Constructor Details
#initialize ⇒ GroongaCommandConvertFormat
Returns a new instance of GroongaCommandConvertFormat.
26 27 28 29 30 |
# File 'lib/groonga/command/parser/command/groonga-command-convert-format.rb', line 26 def initialize @format = :command @uri_prefix = "http://localhost:10041" @pretty_print = true end |
Instance Method Details
#run(argv = ARGV) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/groonga/command/parser/command/groonga-command-convert-format.rb', line 32 def run(argv=ARGV) begin (argv) rescue OptionParser::ParseError puts($!.) return false end input_paths = argv if input_paths.empty? convert($stdin) else input_paths.each do |input_path| File.open(input_path) do |input| convert(input) end end end true end |