app/lib/katello/util/data.rb in katello-4.13.1 vs app/lib/katello/util/data.rb in katello-4.14.0.rc1
- old
+ new
@@ -11,11 +11,12 @@
def self.ostructize(obj, options = {})
options[:prefix_keys] ||= []
options[:prefix] ||= '_'
- if obj.is_a? Hash
+ case obj
+ when Hash
ostructized_hash = {}
obj.each do |key, value|
if options[:prefix_keys].include? key
new_key = (options[:prefix].to_s + key.to_s).to_sym
@@ -29,10 +30,10 @@
ostructized_hash[new_key] = ostructize(value, options)
end
return OpenStruct.new ostructized_hash
- elsif obj.is_a? Array
+ when Array
return obj.map { |r| ostructize(r, options) }
end
return obj