Sha256: 12c8b32f33762d251be52705c3910dc3a1182205e9d567bd976875dcb08b7502

Contents?: true

Size: 658 Bytes

Versions: 9

Compression:

Stored size: 658 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, **dependencies
        super(**dependencies)
        @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

9 entries across 9 versions & 1 rubygems

Version Path
sublime_text_kit-14.1.0 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-14.0.0 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-13.5.0 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-13.4.0 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-13.3.0 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-13.2.0 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-13.1.0 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-13.0.1 lib/sublime_text_kit/snippets/collector.rb
sublime_text_kit-13.0.0 lib/sublime_text_kit/snippets/collector.rb