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, QueryExpand, RangeFilter, Register, Reindex, RequestCancel, RubyEval, RubyLoad, Schema, Select, Shutdown, Status, Suggest, TableCopy, TableCreate, TableList, TableRemove, TableRename, TableTokenize, ThreadLimit, Tokenize, Truncate
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(pair_arguments, ordered_arguments = {}) ⇒ Base
#initialize(command_name, pair_arguments, ordered_arguments = {}) ⇒ Base
Returns a new instance of Base.
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
# File 'lib/groonga/command/base.rb', line 83
def initialize(arg1=nil, arg2=nil, arg3=nil)
case arg1
when String, Symbol
command_name = arg1.to_s
pair_arguments = arg2
ordered_arguments = arg3
else
command_name = self.class.command_name
pair_arguments = arg1
ordered_arguments = arg2
end
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
122
123
124
125
126
|
# File 'lib/groonga/command/base.rb', line 122
def ==(other)
other.is_a?(self.class) and
@command_name == other.name and
@arguments == other.arguments
end
|
#[](name) ⇒ Object
109
110
111
|
# File 'lib/groonga/command/base.rb', line 109
def [](name)
@arguments[normalize_name(name)]
end
|
#[]=(name, value) ⇒ Object
113
114
115
|
# File 'lib/groonga/command/base.rb', line 113
def []=(name, value)
@arguments[normalize_name(name)] = value
end
|
132
133
134
|
# File 'lib/groonga/command/base.rb', line 132
def command_format?
@original_format == :command
end
|
#key?(name) ⇒ Boolean
Also known as:
has_key?
117
118
119
|
# File 'lib/groonga/command/base.rb', line 117
def key?(name)
@arguments.key?(normalize_name(name))
end
|
#name ⇒ Object
105
106
107
|
# File 'lib/groonga/command/base.rb', line 105
def name
command_name
end
|
#output_type ⇒ Object
136
137
138
|
# File 'lib/groonga/command/base.rb', line 136
def output_type
(self[:output_type] || :json).to_sym
end
|
#request_id ⇒ String?
Returns request_id
parameter value.
143
144
145
|
# File 'lib/groonga/command/base.rb', line 143
def request_id
self[:request_id]
end
|
151
152
153
|
# File 'lib/groonga/command/base.rb', line 151
def to_command_format
Format::Command.new(@command_name, normalized_arguments).command_line
end
|
147
148
149
|
# File 'lib/groonga/command/base.rb', line 147
def to_uri_format
Format::URI.new(@path_prefix, @command_name, normalized_arguments).path
end
|
128
129
130
|
# File 'lib/groonga/command/base.rb', line 128
def uri_format?
@original_format == :uri
end
|