Class: Groonga::Client::Request::Generic
- Inherits:
-
Object
- Object
- Groonga::Client::Request::Generic
- Defined in:
- lib/groonga/client/request/generic.rb
Direct Known Subclasses
Instance Method Summary collapse
- #command_name ⇒ Object
- #extensions(*modules, &block) ⇒ Object
- #flags_parameter(name_or_names, value) ⇒ Object
-
#initialize(parameters = nil, extensions = []) ⇒ Generic
constructor
A new instance of Generic.
- #parameter(name, value) ⇒ Object
- #response ⇒ Object
- #to_parameters ⇒ Object
- #values_parameter(name_or_names, values) ⇒ Object
Constructor Details
#initialize(parameters = nil, extensions = []) ⇒ Generic
Returns a new instance of Generic.
21 22 23 24 25 |
# File 'lib/groonga/client/request/generic.rb', line 21 def initialize(parameters=nil, extensions=[]) @parameters = parameters @extensions = extensions extend(*@extensions) unless @extensions.empty? end |
Instance Method Details
#command_name ⇒ Object
27 28 29 |
# File 'lib/groonga/client/request/generic.rb', line 27 def command_name self.class.command_name end |
#extensions(*modules, &block) ⇒ Object
68 69 70 71 72 73 74 75 |
# File 'lib/groonga/client/request/generic.rb', line 68 def extensions(*modules, &block) modules << Module.new(&block) if block if modules.empty? self else create_request(@parameters, @extensions | modules) end end |
#flags_parameter(name_or_names, value) ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/groonga/client/request/generic.rb', line 40 def flags_parameter(name_or_names, value) if name_or_names.is_a?(Array) names = name_or_names else names = [name_or_names] end add_parameter(OverwriteMerger, FlagsParameter.new(names, value)) end |
#parameter(name, value) ⇒ Object
35 36 37 38 |
# File 'lib/groonga/client/request/generic.rb', line 35 def parameter(name, value) add_parameter(OverwriteMerger, RequestParameter.new(name, value)) end |
#response ⇒ Object
31 32 33 |
# File 'lib/groonga/client/request/generic.rb', line 31 def response @reponse ||= create_response end |
#to_parameters ⇒ Object
60 61 62 63 64 65 66 |
# File 'lib/groonga/client/request/generic.rb', line 60 def to_parameters if @parameters.nil? {} else @parameters.to_parameters end end |
#values_parameter(name_or_names, values) ⇒ Object
50 51 52 53 54 55 56 57 58 |
# File 'lib/groonga/client/request/generic.rb', line 50 def values_parameter(name_or_names, values) if name_or_names.is_a?(Array) names = name_or_names else names = [name_or_names] end add_parameter(OverwriteMerger, ValuesParameter.new(names, values)) end |