Class: GrnLine::Wrapper
- Inherits:
-
Object
- Object
- GrnLine::Wrapper
- Defined in:
- lib/grnline/wrapper.rb
Constant Summary collapse
- GROONGA_COMMANDS =
[ "cache_limit", "check", "clearlock", "column_create", "column_list", "column_remove", "column_rename", "define_selector", "defrag", "delete", "dump", "load", "log_level", "log_put", "log_reopen", "quit", "register", "select", "shutdown", "status", "table_create", "table_list", "table_remove", "table_rename", "truncate" ]
- GROONGA_SHUTDOWN_COMMANDS =
["quit", "shutdown"]
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Wrapper
constructor
A new instance of Wrapper.
- #run(argv) ⇒ Object
Constructor Details
#initialize ⇒ Wrapper
Returns a new instance of Wrapper.
27 28 29 30 |
# File 'lib/grnline/wrapper.rb', line 27 def initialize @options = nil setup_input_completion end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
10 11 12 |
# File 'lib/grnline/wrapper.rb', line 10 def @options end |
Class Method Details
.run(argv) ⇒ Object
22 23 24 |
# File 'lib/grnline/wrapper.rb', line 22 def run(argv) new.run(argv) end |
Instance Method Details
#run(argv) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/grnline/wrapper.rb', line 32 def run(argv) @options = (argv) groonga_commandline = generate_groonga_commandline Open3.popen3(*groonga_commandline) do |input, output, error, _| @input, @output, @error = input, output, error return true unless ensure_groonga_running return false unless ensure_groonga_ready setup_interrupt_shutdown while(command = Readline.readline("groonga> ", true)) do process_command(command) exit(true) if GROONGA_SHUTDOWN_COMMANDS.include?(command) end shutdown_groonga end end |