Class: BinData::ArrayArgProcessor

Inherits:
BaseArgProcessor show all
Defined in:
lib/bindata/array.rb

Instance Method Summary collapse

Methods inherited from BaseArgProcessor

#extract_args, #separate_args

Instance Method Details

#sanitize_parameters!(obj_class, params) ⇒ Object

:nodoc:



277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
# File 'lib/bindata/array.rb', line 277

def sanitize_parameters!(obj_class, params) #:nodoc:
  unless params.has_parameter?(:initial_length) or
           params.has_parameter?(:read_until)
    # ensure one of :initial_length and :read_until exists
    params[:initial_length] = 0
  end

  params.warn_replacement_parameter(:length, :initial_length)
  params.warn_replacement_parameter(:read_length, :initial_length)
  params.must_be_integer(:initial_length)

  params.merge!(obj_class.dsl_params)

  if params.needs_sanitizing?(:type)
    el_type, el_params = params[:type]
    params[:type] = params.create_sanitized_object_prototype(el_type, el_params)
  end
end