Sha256: 701ea97395ea99e742a674ae2ff9b9508748fb9e37a4fc4c2a2e70a456ffc593

Contents?: true

Size: 1017 Bytes

Versions: 4

Compression:

Stored size: 1017 Bytes

Contents

# typed: strict
# frozen_string_literal: true

module Etwin
  module Twinoid
    # A valid Twinoid user id
    class TwinoidUserId
      extend T::Helpers
      extend T::Sig

      final!

      protected

      sig(:final) { returns(String) }
      attr_reader :inner

      public

      sig(:final) { params(inner: String).void }
      def initialize(inner)
        @inner = T.let(inner.freeze, String)
        freeze
      end

      sig(:final) { params(other: BasicObject).returns(T::Boolean) }
      def ==(other)
        case other
        when TwinoidUserId
          @inner == other.inner
        else
          false
        end
      end

      sig(:final) { returns(Integer) }
      def hash
        @inner.hash
      end

      sig(:final) { returns(String) }
      def to_s
        @inner
      end

      sig(:final) { returns(String) }
      def as_json
        @inner
      end

      sig(:final) { returns(String) }
      def inspect
        "TwinoidUserId(#{@inner})"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
etwin-0.3.2 lib/etwin/twinoid/twinoid_user_id.rb
etwin-0.0.3 lib/etwin/twinoid/twinoid_user_id.rb
etwin-0.0.2 lib/etwin/twinoid/twinoid_user_id.rb
etwin-0.0.1 lib/etwin/twinoid/twinoid_user_id.rb