Sha256: 76c1e5f62ad5cbe82c7ed1003e6a46534e7c9ae3c04a0dddbfaef1cf10237206
Contents?: true
Size: 444 Bytes
Versions: 75
Compression:
Stored size: 444 Bytes
Contents
module Pageflow module UrlTemplate extend self def from_attachment(attachment, *style) insert_id_partition_placeholder(attachment.url(*style)) end private def insert_id_partition_placeholder(url) replace_last_group_of_digit_segments(url, with: '/:id_partition/') end def replace_last_group_of_digit_segments(str, with:) str.reverse.sub(%r'/(\d{3}/)+', with.reverse).reverse end end end
Version data entries
75 entries across 75 versions & 1 rubygems