Hash
BinData objects are instantiated with parameters to determine their behaviour. These parameters must be sanitized to ensure their values are valid. When instantiating many objects with identical parameters, such as an array of records, there is much duplicated sanitizing.
The purpose of the sanitizing code is to eliminate the duplicated validation.
SanitizedParameters is a hash-like collection of parameters. Its purpose is to recursively sanitize the parameters of an entire BinData object chain at a single time.
Memoized constants
# File lib/bindata/sanitize.rb, line 229 def create_sanitized_choices(choices) SanitizedChoices.new(choices, self.endian) end
# File lib/bindata/sanitize.rb, line 215 def create_sanitized_endian(endian) if endian == :big BIG_ENDIAN elsif endian == :little LITTLE_ENDIAN else raise ArgumentError, "unknown value for endian '#{endian}'" end end
# File lib/bindata/sanitize.rb, line 233 def create_sanitized_fields SanitizedFields.new(self.endian) end
# File lib/bindata/sanitize.rb, line 237 def create_sanitized_object_prototype(obj_type, obj_params) SanitizedPrototype.new(obj_type, obj_params, self.endian) end
# File lib/bindata/sanitize.rb, line 225 def create_sanitized_params(params, the_class) SanitizedParameters.new(params, the_class, self.endian) end
# File lib/bindata/sanitize.rb, line 210 def endian @endian || self[:endian] end
# File lib/bindata/sanitize.rb, line 188 def needs_sanitizing?(key) parameter = self[key] parameter and not parameter.is_a?(SanitizedParameter) end
# File lib/bindata/sanitize.rb, line 201 def warn_renamed_parameter(old_key, new_key) val = delete(old_key) if val self[new_key] = val warn ":#{old_key} has been renamed to :#{new_key} in #{@the_class}. " + "Using :#{old_key} is now deprecated and will be removed in the future" end end
# File lib/bindata/sanitize.rb, line 194 def warn_replacement_parameter(bad_key, suggested_key) if has_parameter?(bad_key) warn ":#{bad_key} is not used with #{@the_class}. " + "You probably want to change this to :#{suggested_key}" end end
Generated with the Darkfish Rdoc Generator 2.