Module: AWS::Core::OptionGrammar::Descriptors::ListMethods::InstanceMethods

Included in:
AWS::Core::OptionGrammar::Descriptors::List, MemberedList
Defined in:
lib/aws/core/option_grammar.rb

Instance Method Summary collapse

Instance Method Details

#hash_format(value) ⇒ Object


225
226
227
228
229
# File 'lib/aws/core/option_grammar.rb', line 225

def hash_format(value)
  value.map do |v|
    member_option.hash_format(v)
  end
end

#joinObject


231
232
233
# File 'lib/aws/core/option_grammar.rb', line 231

def join
  '.'
end

#request_params(value, prefix = nil) ⇒ Object


215
216
217
218
219
220
221
222
223
# File 'lib/aws/core/option_grammar.rb', line 215

def request_params(value, prefix = nil)
  params = []
  value.each do |v|
    name = prefixed_name(prefix) + join + (params.size + 1).to_s
    params << member_option.request_params(v, name)
  end
  return [Http::Request::Param.new(prefixed_name(prefix), "")] if params.empty?
  params
end

#validate(value, context = nil) ⇒ Object


204
205
206
207
208
209
210
211
212
213
# File 'lib/aws/core/option_grammar.rb', line 204

def validate(value, context = nil)
  raise format_error("enumerable value", context) unless
    value.respond_to? :each
  i = 0
  value.each do |member|
    i += 1
    member_option.validate(member,
                           "member #{i} of #{context_description(context)}")
  end
end