lib/bindata/sanitize.rb in bindata-2.2.0 vs lib/bindata/sanitize.rb in bindata-2.3.0

- old
+ new

@@ -26,11 +26,11 @@ @obj_params = SanitizedParameters.new(obj_params, @obj_class, hints) end end def has_parameter?(param) - if @factory + if defined? @factory @factory.has_parameter?(param) else @obj_params.has_parameter?(param) end end @@ -198,11 +198,11 @@ if hints[:endian] self[:endian] ||= hints[:endian] end - if hints[:search_prefix] + if hints[:search_prefix] and not hints[:search_prefix].empty? self[:search_prefix] = Array(self[:search_prefix]).concat(Array(hints[:search_prefix])) end sanitize! end @@ -215,22 +215,22 @@ parameter and not parameter.is_a?(SanitizedParameter) end def warn_replacement_parameter(bad_key, suggested_key) if has_parameter?(bad_key) - warn ":#{bad_key} is not used with #{@the_class}. " + + Kernel.warn ":#{bad_key} is not used with #{@the_class}. " + "You probably want to change this to :#{suggested_key}" end end - 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 +# def warn_renamed_parameter(old_key, new_key) +# val = delete(old_key) +# if val +# self[new_key] = val +# Kernel.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 def must_be_integer(*keys) keys.each do |key| if has_parameter?(key) parameter = self[key]