Sha256: f07fbae88257a77fc2469ea0469d75487b32c68b68ef9a0311a055c5c88ad3a5
Contents?: true
Size: 1015 Bytes
Versions: 32
Compression:
Stored size: 1015 Bytes
Contents
require "fiona7/json/obj_decorator" module Fiona7 module JSON class ReverseObjDecorator < ObjDecorator def as_json(*args) with_types = super() reverse_types = {} with_types.each do |attr, (value, type)| if type.nil? reverse_types[attr] = value else reverse_types[attr] = [type, value] end end if reverse_types[:_widget_pool] && !reverse_types[:_widget_pool].empty? widgets_reverse_types = reverse_types[:_widget_pool].map do |id, values| reversed_values = {} values.each do |attr, (value, type)| if type.nil? reversed_values[attr] = value else reversed_values[attr] = [type, value] end end [id, reversed_values] end reverse_types[:_widget_pool] = Hash[widgets_reverse_types] end reverse_types.as_json(*args) end end end end
Version data entries
32 entries across 32 versions & 1 rubygems