Sha256: b6a1b9f95297cebe86db79ae823fac782ccd93cbffc27cb482e01573996df4e9

Contents?: true

Size: 608 Bytes

Versions: 8

Compression:

Stored size: 608 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[: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

8 entries across 8 versions & 1 rubygems

Version Path
sublime_text_kit-17.6.0 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-17.5.0 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-17.4.0 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-17.3.0 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-17.2.0 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-17.1.0 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-17.0.1 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-17.0.0 lib/sublime_text_kit/snippets/collector.rb