Sha256: 25b65b5c9b8f9171ce3601aa5b9c2df08b8f56d2591d012d854bed3c8fcce85c

Contents?: true

Size: 856 Bytes

Versions: 4

Compression:

Stored size: 856 Bytes

Contents

# frozen_string_literal: true

module SublimeTextKit
  module CLI
    module Actions
      # Handles gem configuration action.
      class Config
        def initialize configuration: Configuration::Loader::HANDLER, container: Container
          @configuration = configuration
          @container = container
        end

        def call action
          case action
            when :edit then edit
            when :view then view
            else logger.error { "Invalid configuration action: #{action}." }
          end
        end

        private

        attr_reader :configuration, :container

        def edit = kernel.system("$EDITOR #{configuration.current}")

        def view = kernel.system("cat #{configuration.current}")

        def kernel = container[__method__]

        def logger = container[__method__]
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sublime_text_kit-11.0.3 lib/sublime_text_kit/cli/actions/config.rb
sublime_text_kit-11.0.2 lib/sublime_text_kit/cli/actions/config.rb
sublime_text_kit-11.0.1 lib/sublime_text_kit/cli/actions/config.rb
sublime_text_kit-11.0.0 lib/sublime_text_kit/cli/actions/config.rb