Sha256: f6a5a79d3c32c4b4d5a4252e9cc05d2ff2fee56f630b0a2fe15962940f223482

Contents?: true

Size: 489 Bytes

Versions: 2

Compression:

Stored size: 489 Bytes

Contents

# frozen_string_literal: true

module Deadpull
  module Values
    class S3Locations < Base
      extend Dry::Initializer

      param :config
      param :environment

      def concretize
        OpenStruct.new(bucket: bucket, prefix: prefix)
      end

      private

      def bucket
        @bucket ||= config[:path].split('/')[0]
      end

      def prefix
        @prefix ||= (config[:path].split('/')[1..-1] + [environment]).reject(&:blank?).join('/')
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
deadpull-0.1.1 lib/deadpull/values/s3_locations.rb
deadpull-0.1.0 lib/deadpull/values/s3_locations.rb