Class: Literal::Openapi::Types::RefType

Inherits:
Object
  • Object
show all
Includes:
Type
Defined in:
lib/literal/openapi/types/ref_type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ RefType

Returns a new instance of RefType.



16
17
18
19
# File 'lib/literal/openapi/types/ref_type.rb', line 16

def initialize(type)
  @type = type
  freeze
end

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



21
22
23
# File 'lib/literal/openapi/types/ref_type.rb', line 21

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



27
28
29
# File 'lib/literal/openapi/types/ref_type.rb', line 27

def ==(other)
  other.is_a?(Literal::Openapi::Types::RefType) && other.type == @type
end

#===(other) ⇒ Object

NOTE: do NOT rewrite to ‘delegate :===, to: :@type` — the gem has no ActiveSupport dependency, so `delegate` is unavailable.



39
40
41
# File 'lib/literal/openapi/types/ref_type.rb', line 39

def ===(other)
  @type === other # rubocop:disable Style/CaseEquality
end

#hashObject



33
34
35
# File 'lib/literal/openapi/types/ref_type.rb', line 33

def hash
  [self.class, @type].hash
end

#inspectObject



23
24
25
# File 'lib/literal/openapi/types/ref_type.rb', line 23

def inspect
  "_Ref(#{@type.name || "<anonymous>"})"
end