lib/bindata/primitive.rb in bindata-2.0.0 vs lib/bindata/primitive.rb in bindata-2.1.0

- old
+ new

@@ -58,21 +58,16 @@ # == Parameters # # Primitive objects accept all the parameters that BinData::BasePrimitive do. # class Primitive < BasePrimitive - include DSLMixin + extend DSLMixin unregister_self - dsl_parser :primitive + dsl_parser :primitive + arg_processor :primitive - class << self - def sanitize_parameters!(params) #:nodoc: - params[:struct_params] = params.create_sanitized_params(dsl_params, BinData::Struct) - end - end - mandatory_parameter :struct_params def initialize_instance @struct = BinData::Struct.new(get_parameter(:struct_params), self) end @@ -135,7 +130,13 @@ raise NotImplementedError end # To be implemented by subclasses ########################################################################### + end + + class PrimitiveArgProcessor < BaseArgProcessor + def sanitize_parameters!(obj_class, params) + params[:struct_params] = params.create_sanitized_params(obj_class.dsl_params, BinData::Struct) + end end end