Method: Notification#stringify_all
- Defined in:
- lib/app/models/notification.rb
#stringify_all(obj) ⇒ Object
Convert all keys and values to strings for liquid sanity
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
# File 'lib/app/models/notification.rb', line 218 def stringify_all(obj) case obj when Hash result = {} obj.each { |key, value| result[key.to_s] = stringify_all(value) } when Array result = [] obj.each { |value| result << stringify_all(value) } when FalseClass result = false when TrueClass result = true else result = obj.to_s end result end |