Sha256: d20a37bbb579ee804533ef3b5d486d82109b53d4190a5e694c3ea550ea9bd10a

Contents?: true

Size: 633 Bytes

Versions: 5

Compression:

Stored size: 633 Bytes

Contents

# frozen_string_literal: true

require "refinements/pathname"

module SublimeTextKit
  module Snippets
    # Collects and loads all snippets into memory for further processing.
    class Collector
      include Import[:configuration]

      using Refinements::Pathname

      def initialize(reader: Reader.new, **)
        super(**)
        @reader = reader
      end

      def call
        configuration.user_dir
                     .files("*.sublime-snippet")
                     .map { |path| reader.call path }
                     .sort_by(&:description)
      end

      private

      attr_reader :reader
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sublime_text_kit-16.5.0 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-16.3.0 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-16.2.0 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-16.1.0 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-16.0.0 lib/sublime_text_kit/snippets/collector.rb