Sha256: 291b88ad3b2c510719f8ca395449f18a1aee748168551315ea647ac9efd11565

Contents?: true

Size: 813 Bytes

Versions: 1

Compression:

Stored size: 813 Bytes

Contents

module LanguageServer
  module Protocol
    module Interface
      class Position
        def initialize(line:, character:)
          @attributes = {}

          @attributes[:line] = line
          @attributes[:character] = character

          @attributes.freeze
        end

        #
        # Line position in a document (zero-based).
        #
        # @return [number]
        def line
          attributes.fetch(:line)
        end

        #
        # Character offset on a line in a document (zero-based).
        #
        # @return [number]
        def character
          attributes.fetch(:character)
        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

1 entries across 1 versions & 1 rubygems

Version Path
language_server-protocol-0.5.0 lib/language_server/protocol/interface/position.rb