Class: Groonga::Command::Parser::Command::GroongaCommandFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/groonga/command/parser/command/groonga-command-filter.rb

Instance Method Summary collapse

Constructor Details

#initializeGroongaCommandFilter

Returns a new instance of GroongaCommandFilter.



26
27
28
29
30
# File 'lib/groonga/command/parser/command/groonga-command-filter.rb', line 26

def initialize
  @include_tables = {}
  @include_schema = true
  @include_load = 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-filter.rb', line 32

def run(argv=ARGV)
  begin
    parse_options!(argv)
  rescue OptionParser::ParseError
    $stderr.puts($!.message)
    return false
  end

  input_paths = argv
  if input_paths.empty?
    filter($stdin)
  else
    input_paths.each do |input_path|
      File.open(input_path) do |input|
        filter(input)
      end
    end
  end

  true
end