Sha256: ee4f87110b9231f629bce60730a00e0e9d16e54844535ff8bcdca670d85974da

Contents?: true

Size: 729 Bytes

Versions: 4

Compression:

Stored size: 729 Bytes

Contents

# frozen_string_literal: true

require "dry/monads"

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

        def initialize
          path = "Library/Application Support/Sublime Text/Local/Session.sublime_session"

          @path = path
        end

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

          Pathname(content[:home]).join(path)
                                  .then { |session_path| Success content.merge!(session_path:) }
        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/session_path.rb
sublime_text_kit-15.0.2 lib/sublime_text_kit/configuration/transformers/session_path.rb
sublime_text_kit-15.0.1 lib/sublime_text_kit/configuration/transformers/session_path.rb
sublime_text_kit-15.0.0 lib/sublime_text_kit/configuration/transformers/session_path.rb