Module: GMSC
- Defined in:
- lib/gmsc.rb,
lib/gmsc/version.rb
Constant Summary collapse
- VERSION =
"0.0.2"
Class Method Summary collapse
Class Method Details
.safe_convert(metadata) ⇒ { String => String, Array<String> }
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/gmsc.rb', line 8 def safe_convert() h = {} .each do |k, v| if k.match?(/-bin$/) # If the value is binary, encode with Base64 h[k] = v.is_a?(Array) ? v.map { |e| Base64.strict_encode64(e) } : Base64.strict_encode64(v) else h[k] = v.is_a?(Array) ? v.map { |e| e.encode(Encoding::UTF_8) } : v.encode(Encoding::UTF_8) end end h end |