Sha256: 1d67420f69e483518f07b2942ab4443148f77720946137710c4d4f87358fdd93

Contents?: true

Size: 901 Bytes

Versions: 1

Compression:

Stored size: 901 Bytes

Contents

#:enddoc:
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

1 entries across 1 versions & 1 rubygems

Version Path
infopark_cloud_connector-6.8.0.210.ed204b0 lib/rails_connector/workspace.rb