Sha256: b79b1972056eb59428b0d4a3f39cb8db61709598766769cab1de99ea1c8d8950

Contents?: true

Size: 891 Bytes

Versions: 4

Compression:

Stored size: 891 Bytes

Contents

module RailsConnector

class Workspace
  extend ActiveModel::Naming
  include Kvom::ModelIdentity

  def self.current=(workspace_or_proc)
    @current = workspace_or_proc
  end

  def self.current
    if @current.respond_to? :call
      @current = @current.call
    else
      @current || default
    end
  end

  def self.default
    find("published")
  end

  def self.find(id)
    Workspace.new(CmsBackend.find_workspace_data_by_id(id))
  end

  def initialize(workspace_data)
    @workspace_data = workspace_data
  end

  def id
    @workspace_data.id
  end

  def revision_id
    @workspace_data.revision_id
  end

  def data
    @workspace_data
  end

  # only available with direct access to dynamo
  def revision
    @workspace_data.revision
  end

  # only available with direct access to dynamo
  def content_cache_id=(id)
    @workspace_data.content_cache_id = id
  end

end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
infopark_cloud_connector-6.8.0.356.19698103 lib/rails_connector/workspace.rb
infopark_cloud_connector-6.8.0.348.160665197 lib/rails_connector/workspace.rb
infopark_cloud_connector-6.8.0.328.4a753fc lib/rails_connector/workspace.rb
infopark_cloud_connector-6.8.0.322.c003f11 lib/rails_connector/workspace.rb