Sha256: 54d86e25ff7d1d7b53aaeaf0414f802286e02d9983914db107ebc7db893a8601

Contents?: true

Size: 845 Bytes

Versions: 2

Compression:

Stored size: 845 Bytes

Contents

module LanguageServer
  module Protocol
    module Interface
      #
      # Value-object describing what options formatting should use.
      #
      class FormattingOptions
        def initialize(tab_size:, insert_spaces:)
          @attributes = {}

          @attributes[:tabSize] = tab_size
          @attributes[:insertSpaces] = insert_spaces

          @attributes.freeze
        end

        #
        # Size of a tab in spaces.
        #
        # @return [number]
        def tab_size
          attributes.fetch(:tabSize)
        end

        #
        # Prefer spaces over tabs.
        #
        # @return [boolean]
        def insert_spaces
          attributes.fetch(:insertSpaces)
        end

        attr_reader :attributes

        def to_json(*args)
          attributes.to_json(*args)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
language_server-protocol-0.4.0 lib/language_server/protocol/interface/formatting_options.rb
language_server-protocol-0.3.0 lib/language_server/protocol/interface/formatting_options.rb