Sha256: 218adb506b581f4d5c36ce232efefd9852cdd9a92db83df9c97d32b1c877b5d0
Contents?: true
Size: 1.69 KB
Versions: 9
Compression:
Stored size: 1.69 KB
Contents
module Scrivito class WorkspaceData class << self private def data_attr_reader(attr_name) define_method(attr_name) { @data[attr_name.to_s] } end end data_attr_reader :id data_attr_reader :title data_attr_reader :memberships data_attr_reader :revision_id data_attr_reader :base_revision_id def content_state_id @data["content_state_id"] or raise InternalError end def content_state_id? @data["content_state_id"].present? end def base_content_state_id @data["base_content_state_id"] or raise InternalError end def base_content_state_id? @data["base_content_state_id"].present? end def initialize(data) raise InternalError unless Hash === data && data["id"].present? @data = data assert_no_obj_classes end private def assert_no_obj_classes if @data['uses_obj_classes'] raise ScrivitoError, "The working copy titled #{title} has ObjClasses, which is no longer "\ "supported. Please use version 0.60.0 to have CMS-based ObjClasses removed from your "\ "working copies. See https://scrivito.com/scrivito/obj-class-migration for a "\ "detailed guide on upgrading." end end def to_hash base_csid = base_content_state_id? ? base_content_state_id : nil { 'id' => id, 'revision_id' => revision_id, 'title' => title, 'content_state_id' => content_state_id, 'base_revision_id' => base_revision_id, 'base_content_state_id' => base_csid, 'memberships' => memberships, } end end end
Version data entries
9 entries across 9 versions & 1 rubygems