Sha256: 85fe3641b81730d99e73ce95472e562191dfab3cd265e2ed000b9201a6b5ddee

Contents?: true

Size: 1.75 KB

Versions: 3

Compression:

Stored size: 1.75 KB

Contents

# frozen_string_literal: true

module ConvenientService
  module Service
    module Plugins
      module HasResult
        module Entities
          class Result
            module Plugins
              module HasJsendStatusAndAttributes
                module Entities
                  class Code
                    module Concern
                      module InstanceMethods
                        ##
                        # @!attribute value [r]
                        #   @return [Symbol]
                        #
                        attr_reader :value

                        ##
                        # @param value [Symbol]
                        # @return [void]
                        #
                        def initialize(value:)
                          @value = value
                        end

                        ##
                        # @param other [Object] Can be any type.
                        # @return [Boolean]
                        #
                        def ==(other)
                          casted = cast(other)

                          return unless casted

                          value == casted.value
                        end

                        ##
                        # @return [String]
                        #
                        def to_s
                          @to_s ||= value.to_s
                        end

                        ##
                        # @return [Symbol]
                        #
                        def to_sym
                          @to_sym ||= value.to_sym
                        end
                      end
                    end
                  end
                end
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
convenient_service-0.11.0 lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/entities/code/concern/instance_methods.rb
convenient_service-0.10.1 lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/entities/code/concern/instance_methods.rb
convenient_service-0.10.0 lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/entities/code/concern/instance_methods.rb