Module: UTF8Encoding::ObjectSupport
- Included in:
- UTF8Encoding
- Defined in:
- lib/ndr_support/utf8_encoding/object_support.rb
Instance Method Summary collapse
-
#ensure_utf8_array!(array) ⇒ Object
Ensures all elements of the given ‘array` are UTF-8, where possible.
-
#ensure_utf8_hash!(hash) ⇒ Object
Ensures all values of the given ‘hash` are UTF-8, where possible.
-
#ensure_utf8_object!(object) ⇒ Object
Recursively ensure the correct encoding is being used:.
Instance Method Details
#ensure_utf8_array!(array) ⇒ Object
Ensures all elements of the given ‘array` are UTF-8, where possible.
25 26 27 |
# File 'lib/ndr_support/utf8_encoding/object_support.rb', line 25 def ensure_utf8_array!(array) array.each { |element| ensure_utf8_object!(element) } end |
#ensure_utf8_hash!(hash) ⇒ Object
Ensures all values of the given ‘hash` are UTF-8, where possible.
20 21 22 |
# File 'lib/ndr_support/utf8_encoding/object_support.rb', line 20 def ensure_utf8_hash!(hash) hash.each_value { |value| ensure_utf8_object!(value) } end |
#ensure_utf8_object!(object) ⇒ Object
Recursively ensure the correct encoding is being used:
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/ndr_support/utf8_encoding/object_support.rb', line 6 def ensure_utf8_object!(object) case object when String ensure_utf8!(object) when Hash ensure_utf8_hash!(object) when Array ensure_utf8_array!(object) else object end end |