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
56
57
58
59
60
61
62
|
# File 'lib/groonga/command/base.rb', line 56
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.
54
55
56
|
# File 'lib/groonga/command/base.rb', line 54
def arguments
@arguments
end
|
#command_name ⇒ String
Returns The command name.
72
73
74
|
# File 'lib/groonga/command/base.rb', line 72
def command_name
@command_name
end
|
Returns the value of attribute original_format.
55
56
57
|
# File 'lib/groonga/command/base.rb', line 55
def original_format
@original_format
end
|
#original_source ⇒ Object
Returns the value of attribute original_source.
55
56
57
|
# File 'lib/groonga/command/base.rb', line 55
def original_source
@original_source
end
|
#path_prefix ⇒ Object
Returns the value of attribute path_prefix.
55
56
57
|
# File 'lib/groonga/command/base.rb', line 55
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
89
90
91
92
93
|
# File 'lib/groonga/command/base.rb', line 89
def ==(other)
other.is_a?(self.class) and
@name == other.name and
@arguments == other.arguments
end
|
#[](name) ⇒ Object
76
77
78
|
# File 'lib/groonga/command/base.rb', line 76
def [](name)
@arguments[normalize_name(name)]
end
|
#[]=(name, value) ⇒ Object
80
81
82
|
# File 'lib/groonga/command/base.rb', line 80
def []=(name, value)
@arguments[normalize_name(name)] = value
end
|
99
100
101
|
# File 'lib/groonga/command/base.rb', line 99
def command_format?
@original_format == :command
end
|
#key?(name) ⇒ Boolean
Also known as:
has_key?
84
85
86
|
# File 'lib/groonga/command/base.rb', line 84
def key?(name)
@arguments.key?(normalize_name(name))
end
|
#name ⇒ Object
65
66
67
|
# File 'lib/groonga/command/base.rb', line 65
def name
command_name
end
|
#output_type ⇒ Object
103
104
105
|
# File 'lib/groonga/command/base.rb', line 103
def output_type
(self[:output_type] || :json).to_sym
end
|
#request_id ⇒ String?
Returns request_id parameter value.
110
111
112
|
# File 'lib/groonga/command/base.rb', line 110
def request_id
self[:request_id]
end
|
118
119
120
|
# File 'lib/groonga/command/base.rb', line 118
def to_command_format
Format::Command.new(@name, normalized_arguments).command_line
end
|
114
115
116
|
# File 'lib/groonga/command/base.rb', line 114
def to_uri_format
Format::URI.new(@path_prefix, @name, normalized_arguments).path
end
|
95
96
97
|
# File 'lib/groonga/command/base.rb', line 95
def uri_format?
@original_format == :uri
end
|