Class: Groonga::Client::Request::RequestParameter

Inherits:
Object
  • Object
show all
Defined in:
lib/groonga/client/request/generic.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, value) ⇒ RequestParameter

Returns a new instance of RequestParameter.



103
104
105
106
# File 'lib/groonga/client/request/generic.rb', line 103

def initialize(name, value)
  @name = name
  @value = value
end

Instance Method Details

#to_parametersObject



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/groonga/client/request/generic.rb', line 108

def to_parameters
  case @value
  when Symbol
    value = @value.to_s
  when String
    return {} if @value.empty?
    value = @value
  when Numeric
    value = @value.to_s
  when NilClass
    return {}
  else
    value = @value
  end
  {
    @name => value,
  }
end