Sha256: 87314b3aa6feaaa0809a8d898e6512d50291ecba19b98d49f08d93a8a61662fb

Contents?: true

Size: 1018 Bytes

Versions: 4

Compression:

Stored size: 1018 Bytes

Contents

# frozen_string_literal: true

module ConvenientService
  module Examples
    module Standard
      module V1
        class RequestParams
          module Entities
            ##
            # TODO: https://ruby-doc.org/3.1.3/stdlibs/yaml/YAML/DBM.html
            #
            class ID
              def initialize(value:)
                @value = value
              end

              class << self
                def cast(value)
                  case value
                  when ::String, ::Integer
                    new(value: value.to_s)
                  end
                end
              end

              def ==(other)
                return unless other.instance_of?(self.class)

                value == other.value
              end

              def to_i
                value.to_i
              end

              def to_s
                value
              end

              protected

              attr_reader :value
            end
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
convenient_service-0.17.0 lib/convenient_service/examples/standard/v1/request_params/entities/id.rb
convenient_service-0.16.0 lib/convenient_service/examples/standard/v1/request_params/entities/id.rb
convenient_service-0.15.0 lib/convenient_service/examples/standard/v1/request_params/entities/id.rb
convenient_service-0.14.0 lib/convenient_service/examples/standard/v1/request_params/entities/id.rb