Sha256: 57d9b89135c0fed8edfc49d072c0fd739731a0cb70ed7b5d2e16da4e25bed955

Contents?: true

Size: 614 Bytes

Versions: 1

Compression:

Stored size: 614 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 Dependencies[:settings]

      using Refinements::Pathname

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

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

      private

      attr_reader :reader
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sublime_text_kit-18.0.0 lib/sublime_text_kit/snippets/collector.rb