Sha256: bc7e24950a34932c17ff39a11c87128e1b029355a153c72b84a343c00d459f4b
Contents?: true
Size: 843 Bytes
Versions: 87
Compression:
Stored size: 843 Bytes
Contents
module Scrivito module Backend class ObjDataFromRest < ObjData def initialize(data) raise InternalError unless Hash === data @data = data end def raw_value_and_type_of(attribute_name) return [value_of_widget_pool, nil] if attribute_name == '_widget_pool' if attribute_data = @data[attribute_name] if attribute_name.starts_with?('_') [attribute_data, nil] else [attribute_data[1], attribute_data[0]] end else [nil, nil] end end def attribute_names @data.keys end def to_h @data end private def value_of_widget_pool if widget_pool = @data['_widget_pool'] # using Hash#merge to "map" to a new Hash widget_pool.merge(widget_pool) do |id, raw_widget_data| self.class.new(raw_widget_data) end end end end end end
Version data entries
87 entries across 87 versions & 1 rubygems