Sha256: b0ca4c189ded97426b42e59194264a136381ca35c46428227f9499a5a5a1b4cc

Contents?: true

Size: 1.07 KB

Versions: 11

Compression:

Stored size: 1.07 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.fetch("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

11 entries across 11 versions & 1 rubygems

Version Path
sublime_text_kit-14.2.0 lib/sublime_text_kit/configuration/content.rb
sublime_text_kit-14.1.2 lib/sublime_text_kit/configuration/content.rb
sublime_text_kit-14.1.1 lib/sublime_text_kit/configuration/content.rb
sublime_text_kit-14.1.0 lib/sublime_text_kit/configuration/content.rb
sublime_text_kit-14.0.0 lib/sublime_text_kit/configuration/content.rb
sublime_text_kit-13.5.0 lib/sublime_text_kit/configuration/content.rb
sublime_text_kit-13.4.0 lib/sublime_text_kit/configuration/content.rb
sublime_text_kit-13.3.0 lib/sublime_text_kit/configuration/content.rb
sublime_text_kit-13.2.0 lib/sublime_text_kit/configuration/content.rb
sublime_text_kit-13.1.0 lib/sublime_text_kit/configuration/content.rb
sublime_text_kit-13.0.1 lib/sublime_text_kit/configuration/content.rb