Class: Gitlab::GrapeOpenapi::TagRegistry

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/grape_openapi/tag_registry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTagRegistry

Returns a new instance of TagRegistry.



8
9
10
# File 'lib/gitlab/grape_openapi/tag_registry.rb', line 8

def initialize
  @tags = []
end

Instance Attribute Details

#tagsObject (readonly)

Returns the value of attribute tags.



6
7
8
# File 'lib/gitlab/grape_openapi/tag_registry.rb', line 6

def tags
  @tags
end

Instance Method Details

#register(tag) ⇒ Object



12
13
14
15
16
# File 'lib/gitlab/grape_openapi/tag_registry.rb', line 12

def register(tag)
  return if tag_exists?(tag)

  tags << tag.to_h
end

#to_hObject



18
19
20
# File 'lib/gitlab/grape_openapi/tag_registry.rb', line 18

def to_h
  { tags: @tags }
end