Class: Groonga::Command::Base
- Inherits:
-
Object
- Object
- Groonga::Command::Base
show all
- Defined in:
- lib/groonga/command/base.rb
Direct Known Subclasses
ColumnCopy, ColumnCreate, ColumnList, ColumnRemove, ColumnRename, ConfigDelete, ConfigGet, ConfigSet, Delete, Dump, Get, IOFlush, Load, LogLevel, LogPut, LogicalCount, LogicalRangeFilter, LogicalSelect, LogicalShardList, LogicalTableRemove, Normalize, ObjectExist, ObjectInspect, ObjectRemove, PluginRegister, PluginUnregister, RangeFilter, Register, Reindex, RequestCancel, RubyEval, RubyLoad, Select, Shutdown, Status, Suggest, TableCreate, TableList, TableRemove, TableRename, TableTokenize, ThreadLimit, Tokenize, Truncate
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(command_name, pair_arguments, ordered_arguments = []) ⇒ Base
Returns a new instance of Base.
60
61
62
63
64
65
66
|
# File 'lib/groonga/command/base.rb', line 60
def initialize(command_name, pair_arguments, ordered_arguments=[])
@command_name = command_name
@arguments = construct_arguments(pair_arguments, ordered_arguments)
@original_format = nil
@original_source = nil
@path_prefix = "/d/"
end
|
Instance Attribute Details
#arguments ⇒ Object
Returns the value of attribute arguments.
58
59
60
|
# File 'lib/groonga/command/base.rb', line 58
def arguments
@arguments
end
|
#command_name ⇒ String
Returns The command name.
57
58
59
|
# File 'lib/groonga/command/base.rb', line 57
def command_name
@command_name
end
|
Returns the value of attribute original_format.
59
60
61
|
# File 'lib/groonga/command/base.rb', line 59
def original_format
@original_format
end
|
#original_source ⇒ Object
Returns the value of attribute original_source.
59
60
61
|
# File 'lib/groonga/command/base.rb', line 59
def original_source
@original_source
end
|
#path_prefix ⇒ Object
Returns the value of attribute path_prefix.
59
60
61
|
# File 'lib/groonga/command/base.rb', line 59
def path_prefix
@path_prefix
end
|
Class Method Details
.parameter_names ⇒ Object
49
50
51
|
# File 'lib/groonga/command/base.rb', line 49
def parameter_names
[]
end
|
Instance Method Details
#==(other) ⇒ Object
86
87
88
89
90
|
# File 'lib/groonga/command/base.rb', line 86
def ==(other)
other.is_a?(self.class) and
@command_name == other.name and
@arguments == other.arguments
end
|
#[](name) ⇒ Object
73
74
75
|
# File 'lib/groonga/command/base.rb', line 73
def [](name)
@arguments[normalize_name(name)]
end
|
#[]=(name, value) ⇒ Object
77
78
79
|
# File 'lib/groonga/command/base.rb', line 77
def []=(name, value)
@arguments[normalize_name(name)] = value
end
|
96
97
98
|
# File 'lib/groonga/command/base.rb', line 96
def command_format?
@original_format == :command
end
|
#key?(name) ⇒ Boolean
Also known as:
has_key?
81
82
83
|
# File 'lib/groonga/command/base.rb', line 81
def key?(name)
@arguments.key?(normalize_name(name))
end
|
#name ⇒ Object
69
70
71
|
# File 'lib/groonga/command/base.rb', line 69
def name
command_name
end
|
#output_type ⇒ Object
100
101
102
|
# File 'lib/groonga/command/base.rb', line 100
def output_type
(self[:output_type] || :json).to_sym
end
|
#request_id ⇒ String?
Returns request_id parameter value.
107
108
109
|
# File 'lib/groonga/command/base.rb', line 107
def request_id
self[:request_id]
end
|
115
116
117
|
# File 'lib/groonga/command/base.rb', line 115
def to_command_format
Format::Command.new(@command_name, normalized_arguments).command_line
end
|
111
112
113
|
# File 'lib/groonga/command/base.rb', line 111
def to_uri_format
Format::URI.new(@path_prefix, @command_name, normalized_arguments).path
end
|
92
93
94
|
# File 'lib/groonga/command/base.rb', line 92
def uri_format?
@original_format == :uri
end
|