Class: ConvenientService::Examples::Standard::RequestParams::Entities::ID

Inherits:
Object
  • Object
show all
Defined in:
lib/convenient_service/examples/standard/request_params/entities/id.rb

Overview

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value:) ⇒ ID

Returns a new instance of ID.



17
18
19
# File 'lib/convenient_service/examples/standard/request_params/entities/id.rb', line 17

def initialize(value:)
  @value = value
end

Class Method Details

.cast(value) ⇒ Object



22
23
24
25
26
27
# File 'lib/convenient_service/examples/standard/request_params/entities/id.rb', line 22

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

Instance Method Details

#==(other) ⇒ Object



30
31
32
33
34
# File 'lib/convenient_service/examples/standard/request_params/entities/id.rb', line 30

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

  value == other.value
end

#to_iObject



36
37
38
# File 'lib/convenient_service/examples/standard/request_params/entities/id.rb', line 36

def to_i
  value.to_i
end

#to_sObject



40
41
42
# File 'lib/convenient_service/examples/standard/request_params/entities/id.rb', line 40

def to_s
  value
end