Sha256: bc9d15538c2e191c2f5cdcf9a1297923c7e7b55e841e1311de38b5e8fa5069e1

Contents?: true

Size: 692 Bytes

Versions: 4

Compression:

Stored size: 692 Bytes

Contents

# frozen_string_literal: true

require "dry/monads"

module SublimeTextKit
  module Configuration
    module Transformers
      # Transforms user directory into fully qualified path based on home directory.
      class UserDir
        include Dry::Monads[:result]

        def initialize path = "Library/Application Support/Sublime Text/Packages/User"
          @path = path
        end

        def call content
          return Success content unless content.key? :home

          Pathname(content[:home]).join(path)
                                  .then { |user_dir| Success content.merge!(user_dir:) }
        end

        private

        attr_reader :path
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sublime_text_kit-15.0.3 lib/sublime_text_kit/configuration/transformers/user_dir.rb
sublime_text_kit-15.0.2 lib/sublime_text_kit/configuration/transformers/user_dir.rb
sublime_text_kit-15.0.1 lib/sublime_text_kit/configuration/transformers/user_dir.rb
sublime_text_kit-15.0.0 lib/sublime_text_kit/configuration/transformers/user_dir.rb