Class: Metanorma::Release::DraftSuffixSlug
- Inherits:
-
Object
- Object
- Metanorma::Release::DraftSuffixSlug
- Includes:
- SlugStrategy
- Defined in:
- lib/metanorma/release/slug_strategy.rb
Constant Summary collapse
- DRAFT_SUFFIX =
/-d(\d+)\z/
Instance Method Summary collapse
- #compute_asset_name(publication) ⇒ Object
- #compute_tag(publication) ⇒ Object
-
#initialize ⇒ DraftSuffixSlug
constructor
A new instance of DraftSuffixSlug.
Methods included from SlugStrategy
publisher_from_identifier, slug_from_identifier
Constructor Details
#initialize ⇒ DraftSuffixSlug
Returns a new instance of DraftSuffixSlug.
116 117 118 |
# File 'lib/metanorma/release/slug_strategy.rb', line 116 def initialize @fallback = EditionSlug.new end |
Instance Method Details
#compute_asset_name(publication) ⇒ Object
109 110 111 112 113 114 |
# File 'lib/metanorma/release/slug_strategy.rb', line 109 def compute_asset_name(publication) match = publication.identifier.match(DRAFT_SUFFIX) return @fallback.compute_asset_name(publication) unless match "#{publication.slug}.zip" end |
#compute_tag(publication) ⇒ Object
100 101 102 103 104 105 106 107 |
# File 'lib/metanorma/release/slug_strategy.rb', line 100 def compute_tag(publication) match = publication.identifier.match(DRAFT_SUFFIX) return @fallback.compute_tag(publication) unless match base = publication.identifier.sub(DRAFT_SUFFIX, "") num = match[1] { tag: "#{base}/#{num}", pre_release: true } end |