Sha256: e9b9b1c9bd7d83abd19b17e51d985bbabca24903204b1ac773e27429db743a0f

Contents?: true

Size: 635 Bytes

Versions: 10

Compression:

Stored size: 635 Bytes

Contents

# frozen_string_literal: true

require "refinements/pathnames"

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

      using Refinements::Pathnames

      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

10 entries across 10 versions & 1 rubygems

Version Path
sublime_text_kit-15.2.1 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-15.2.0 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-15.1.0 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-15.0.3 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-15.0.2 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-15.0.1 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-15.0.0 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-14.2.0 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-14.1.2 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-14.1.1 lib/sublime_text_kit/snippets/collector.rb