Class: Metanorma::Release::DocumentReleasePolicy
- Inherits:
-
Object
- Object
- Metanorma::Release::DocumentReleasePolicy
- Defined in:
- lib/metanorma/release/channel_manifest.rb
Instance Attribute Summary collapse
-
#channels ⇒ Object
readonly
Returns the value of attribute channels.
-
#stage_allow_list ⇒ Object
readonly
Returns the value of attribute stage_allow_list.
Class Method Summary collapse
- .build_channels(visibility, explicit_channels) ⇒ Object
- .from_defaults(visibility, channels) ⇒ Object
- .from_entry(entry) ⇒ Object
- .not_released ⇒ Object
Instance Method Summary collapse
-
#initialize(release:, channels:, stage_allow_list:) ⇒ DocumentReleasePolicy
constructor
A new instance of DocumentReleasePolicy.
- #release? ⇒ Boolean
Constructor Details
#initialize(release:, channels:, stage_allow_list:) ⇒ DocumentReleasePolicy
Returns a new instance of DocumentReleasePolicy.
23 24 25 26 27 28 |
# File 'lib/metanorma/release/channel_manifest.rb', line 23 def initialize(release:, channels:, stage_allow_list:) @release = release @channels = channels.freeze @stage_allow_list = stage_allow_list freeze end |
Instance Attribute Details
#channels ⇒ Object (readonly)
Returns the value of attribute channels.
34 35 36 |
# File 'lib/metanorma/release/channel_manifest.rb', line 34 def channels @channels end |
#stage_allow_list ⇒ Object (readonly)
Returns the value of attribute stage_allow_list.
34 35 36 |
# File 'lib/metanorma/release/channel_manifest.rb', line 34 def stage_allow_list @stage_allow_list end |
Class Method Details
.build_channels(visibility, explicit_channels) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/metanorma/release/channel_manifest.rb', line 36 def self.build_channels(visibility, explicit_channels) return explicit_channels if explicit_channels && !explicit_channels.empty? case visibility when 'public' then [Channel.public('default')] when 'members' then [Channel.members('default')] else [].freeze end end |
.from_defaults(visibility, channels) ⇒ Object
8 9 10 11 12 |
# File 'lib/metanorma/release/channel_manifest.rb', line 8 def self.from_defaults(visibility, channels) ch = build_channels(visibility, channels) is_released = visibility != 'private' || !ch.empty? new(release: is_released, channels: ch, stage_allow_list: nil) end |
.from_entry(entry) ⇒ Object
14 15 16 17 |
# File 'lib/metanorma/release/channel_manifest.rb', line 14 def self.from_entry(entry) ch = build_channels(entry.visibility, entry.channels) new(release: true, channels: ch, stage_allow_list: entry.stages_set) end |
.not_released ⇒ Object
19 20 21 |
# File 'lib/metanorma/release/channel_manifest.rb', line 19 def self.not_released new(release: false, channels: [].freeze, stage_allow_list: nil) end |
Instance Method Details
#release? ⇒ Boolean
30 31 32 |
# File 'lib/metanorma/release/channel_manifest.rb', line 30 def release? @release end |