Sha256: 49a1ea114dea23c241ff87402b684d966645c7c9e58188654aa6829b4b54e82f

Contents?: true

Size: 1.06 KB

Versions: 8

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

require "refinements/pathnames"

module SublimeTextKit
  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"

        freeze
      end

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sublime_text_kit-13.0.0 lib/sublime_text_kit/configuration/content.rb
sublime_text_kit-12.3.2 lib/sublime_text_kit/configuration/content.rb
sublime_text_kit-12.3.1 lib/sublime_text_kit/configuration/content.rb
sublime_text_kit-12.3.0 lib/sublime_text_kit/configuration/content.rb
sublime_text_kit-12.2.0 lib/sublime_text_kit/configuration/content.rb
sublime_text_kit-12.1.0 lib/sublime_text_kit/configuration/content.rb
sublime_text_kit-12.0.1 lib/sublime_text_kit/configuration/content.rb
sublime_text_kit-12.0.0 lib/sublime_text_kit/configuration/content.rb