method
process_hash
v6.1.7.7 -
Show latest stable
-
0 notes -
Class: XMLConverter
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0
- 3.0.9
- 3.1.0
- 3.2.1
- 3.2.8
- 3.2.13
- 4.0.2 (0)
- 4.1.8 (0)
- 4.2.1 (0)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1 (0)
- 5.1.7 (0)
- 5.2.3 (0)
- 6.0.0 (0)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2 (0)
- 7.1.3.4 (0)
- What's this?
process_hash(value)
private
Hide source
# File activesupport/lib/active_support/core_ext/hash/conversions.rb, line 186 def process_hash(value) if value.include?("type") && !value["type"].is_a?(Hash) && @disallowed_types.include?(value["type"]) raise DisallowedType, value["type"] end if become_array?(value) _, entries = Array.wrap(value.detect { |k, v| not v.is_a?(String) }) if entries.nil? || value["__content__"].try(:empty?) [] else case entries when Array entries.collect { |v| deep_to_h(v) } when Hash [deep_to_h(entries)] else raise "can't typecast #{entries.inspect}" end end elsif become_content?(value) process_content(value) elsif become_empty_string?(value) "" elsif become_hash?(value) xml_value = value.transform_values { |v| deep_to_h(v) } # Turn { files: { file: #<StringIO> } } into { files: #<StringIO> } so it is compatible with # how multipart uploaded files from HTML appear xml_value["file"].is_a?(StringIO) ? xml_value["file"] : xml_value end end