Class: Workarea::SavePublishing
- Inherits:
-
Object
- Object
- Workarea::SavePublishing
- Defined in:
- app/services/workarea/save_publishing.rb
Instance Method Summary collapse
- #activate? ⇒ Boolean
- #active_segment_ids ⇒ Object
-
#initialize(releasable, params) ⇒ SavePublishing
constructor
A new instance of SavePublishing.
- #perform ⇒ Object
- #release ⇒ Object
Constructor Details
#initialize(releasable, params) ⇒ SavePublishing
Returns a new instance of SavePublishing.
5 6 7 8 |
# File 'app/services/workarea/save_publishing.rb', line 5 def initialize(releasable, params) @releasable = releasable @params = params end |
Instance Method Details
#activate? ⇒ Boolean
30 31 32 |
# File 'app/services/workarea/save_publishing.rb', line 30 def activate? @params[:activate] != 'never' end |
#active_segment_ids ⇒ Object
34 35 36 |
# File 'app/services/workarea/save_publishing.rb', line 34 def active_segment_ids Array.wrap(@params[:active_segment_ids]) end |
#perform ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'app/services/workarea/save_publishing.rb', line 10 def perform return false if release.present? && !release.valid? return true if @releasable.blank? Release.with_current(release.try(:id)) do @releasable.update!(active: activate?, active_segment_ids: active_segment_ids) end end |