Sha256: 575c874e5eb7ff5f150cc05c7e9ad654d0ce12cfd8a46fc40ebd9bece739933f

Contents?: true

Size: 896 Bytes

Versions: 6

Compression:

Stored size: 896 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_hash
          attributes
        end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
language_server-protocol-3.14.0.2 lib/language_server/protocol/interface/formatting_options.rb
language_server-protocol-3.14.0.1 lib/language_server/protocol/interface/formatting_options.rb
language_server-protocol-3.14.0.0 lib/language_server/protocol/interface/formatting_options.rb
language_server-protocol-3.12.0.0 lib/language_server/protocol/interface/formatting_options.rb
language_server-protocol-3.7.0.0 lib/language_server/protocol/interface/formatting_options.rb
language_server-protocol-0.5.0 lib/language_server/protocol/interface/formatting_options.rb