Class: Fiona7::Workspace
- Inherits:
-
Object
- Object
- Fiona7::Workspace
- Defined in:
- lib/fiona7/workspace.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
- #as_json(*options) ⇒ Object
- #base_content_state_id ⇒ Object
- #base_revision_id ⇒ Object
- #content_state_id ⇒ Object
-
#initialize(id) ⇒ Workspace
constructor
A new instance of Workspace.
- #memberships ⇒ Object
- #revision_id ⇒ Object
Constructor Details
#initialize(id) ⇒ Workspace
Returns a new instance of Workspace.
18 19 20 21 22 23 24 25 |
# File 'lib/fiona7/workspace.rb', line 18 def initialize(id) @id = id.to_sym Assert.constraint( @id == :rtc || @id == :published, "Only published and rtc workspaces are possible" ) @version_helper = VersionHelper.new(@id) end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/fiona7/workspace.rb', line 6 def id @id end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
6 7 8 |
# File 'lib/fiona7/workspace.rb', line 6 def title @title end |
Class Method Details
.published ⇒ Object
13 14 15 |
# File 'lib/fiona7/workspace.rb', line 13 def published self.new(:published) end |
.rtc ⇒ Object
9 10 11 |
# File 'lib/fiona7/workspace.rb', line 9 def rtc self.new(:rtc) end |
Instance Method Details
#as_json(*options) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/fiona7/workspace.rb', line 56 def as_json(*) r = { id: self.id, title: self.title, revision_id: self.revision_id, content_state_id: self.content_state_id, outdated: false, auto_update: (self.id == :rtc), memberships: self.memberships } r.merge!({ base_revision_id: self.base_revision_id, base_content_state_id: self.base_content_state_id }) if self.id == :rtc r.as_json(*) end |
#base_content_state_id ⇒ Object
48 49 50 |
# File 'lib/fiona7/workspace.rb', line 48 def base_content_state_id self.version_helper.base_content_state_id if self.id == :rtc end |
#base_revision_id ⇒ Object
44 45 46 |
# File 'lib/fiona7/workspace.rb', line 44 def base_revision_id self.version_helper.base_revision_id if self.id == :rtc end |
#content_state_id ⇒ Object
40 41 42 |
# File 'lib/fiona7/workspace.rb', line 40 def content_state_id self.version_helper.content_state_id end |
#memberships ⇒ Object
52 53 54 |
# File 'lib/fiona7/workspace.rb', line 52 def memberships {} end |
#revision_id ⇒ Object
36 37 38 |
# File 'lib/fiona7/workspace.rb', line 36 def revision_id self.version_helper.revision_id end |