Sha256: e9ffe67b4875ce52340263f40fac942d0a3ea0d5e8438b846eb4533d78122759

Contents?: true

Size: 702 Bytes

Versions: 9

Compression:

Stored size: 702 Bytes

Contents

# frozen_string_literal: true

module SublimeTextKit
  module CLI
    module Actions
      # Handles snippets action.
      class Snippets
        include SublimeTextKit::Import[:configuration, :logger]

        def initialize printer: SublimeTextKit::Snippets::Printer.new, **dependencies
          super(**dependencies)
          @printer = printer
        end

        def call kind
          case kind
            when :ascii_doc then printer.call "*"
            when :markdown then printer.call "-"
            else logger.error { "Invalid snippet format: #{kind}. Use ascii_doc or markdown." }
          end
        end

        private

        attr_reader :printer
      end
    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/cli/actions/snippets.rb
sublime_text_kit-14.0.0 lib/sublime_text_kit/cli/actions/snippets.rb
sublime_text_kit-13.5.0 lib/sublime_text_kit/cli/actions/snippets.rb
sublime_text_kit-13.4.0 lib/sublime_text_kit/cli/actions/snippets.rb
sublime_text_kit-13.3.0 lib/sublime_text_kit/cli/actions/snippets.rb
sublime_text_kit-13.2.0 lib/sublime_text_kit/cli/actions/snippets.rb
sublime_text_kit-13.1.0 lib/sublime_text_kit/cli/actions/snippets.rb
sublime_text_kit-13.0.1 lib/sublime_text_kit/cli/actions/snippets.rb
sublime_text_kit-13.0.0 lib/sublime_text_kit/cli/actions/snippets.rb