Class: Nexmo::OAS::Renderer::Presenters::ResponseTab::Link

Inherits:
Object
  • Object
show all
Defined in:
lib/nexmo/oas/renderer/presenters/response_tab/link.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(index:, schema:) ⇒ Link

Returns a new instance of Link.



11
12
13
14
# File 'lib/nexmo/oas/renderer/presenters/response_tab/link.rb', line 11

def initialize(index:, schema:)
  @index  = index
  @schema = schema
end

Instance Attribute Details

#indexObject (readonly)

Returns the value of attribute index.



9
10
11
# File 'lib/nexmo/oas/renderer/presenters/response_tab/link.rb', line 9

def index
  @index
end

Instance Method Details

#contentObject



28
29
30
# File 'lib/nexmo/oas/renderer/presenters/response_tab/link.rb', line 28

def content
  @schema['description'] || "Response #{@index + 1}"
end

#css_classesObject



16
17
18
19
20
# File 'lib/nexmo/oas/renderer/presenters/response_tab/link.rb', line 16

def css_classes
  classes = ['tab-sync Vlt-tabs__link']
  classes << 'Vlt-tabs__link_active' if @index.zero?
  classes.join(' ')
end


22
23
24
25
26
# File 'lib/nexmo/oas/renderer/presenters/response_tab/link.rb', line 22

def data_tab_link
  return nil unless @schema['x-tab-id']

  @schema['x-tab-id']
end