Sha256: 9d082e1f8abe5d4b7c49350f38fa6cb165a295dc660bb028e6ed0cfba8af74df

Contents?: true

Size: 846 Bytes

Versions: 7

Compression:

Stored size: 846 Bytes

Contents

module LanguageServer
  module Protocol
    module Interfaces
      #
      # 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

7 entries across 7 versions & 2 rubygems

Version Path
language_server-protocol-0.2.0 lib/language_server/protocol/interfaces/formatting_options.rb
language_server-protocol-0.1.0 lib/language_server/protocol/interfaces/formatting_options.rb
language_server-0.4.0 lib/language_server/protocol/interfaces/formatting_options.rb
language_server-0.3.1 lib/language_server/protocol/interfaces/formatting_options.rb
language_server-0.3.0 lib/language_server/protocol/interfaces/formatting_options.rb
language_server-0.2.0 lib/language_server/protocol/interfaces/formatting_options.rb
language_server-0.1.0 lib/language_server/protocol/interfaces/formatting_options.rb