Sha256: f86cd38c1a86861aafaf793701e49384ab90780f9f88fd3e448ed1fe7a8c898e

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

require "refinements/pathnames"

module SublimeTextKit
  module CLI
    module Configuration
      # Defines configuration content as the primary source of truth for use throughout the gem.
      Content = Struct.new(
        :action_config,
        :action_help,
        :action_metadata,
        :action_session,
        :action_snippets,
        :action_update,
        :action_version,
        :project_roots,
        :metadata_dir,
        :snippets_format,
        :session_path,
        :user_dir,
        keyword_init: true
      ) do
        using Refinements::Pathnames

        def initialize *arguments
          super

          home = Pathname ENV["HOME"]

          self[:session_path] ||= home.join(
            "Library/Application Support/Sublime Text/Local/Session.sublime_session"
          )

          self[:user_dir] ||= home.join "Library/Application Support/Sublime Text/Packages/User"
        end

        def project_dirs
          Array(project_roots).map { |path| Pathname(path).expand_path }
                              .flat_map(&:directories)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sublime_text_kit-11.0.3 lib/sublime_text_kit/cli/configuration/content.rb
sublime_text_kit-11.0.2 lib/sublime_text_kit/cli/configuration/content.rb
sublime_text_kit-11.0.1 lib/sublime_text_kit/cli/configuration/content.rb
sublime_text_kit-11.0.0 lib/sublime_text_kit/cli/configuration/content.rb