Class: Aws::Api::Documenter::Tabulator Private
- Inherits:
-
Object
- Object
- Aws::Api::Documenter::Tabulator
- Defined in:
- lib/aws-sdk-core/api/documenter.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
-
#initialize ⇒ Tabulator
constructor
private
A new instance of Tabulator.
- #tab(method_name, tab_name, &block) ⇒ Object private
- #to_html ⇒ Object (also: #inspect, #to_str, #to_s) private
Constructor Details
#initialize ⇒ Tabulator
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Tabulator.
202 203 204 205 |
# File 'lib/aws-sdk-core/api/documenter.rb', line 202 def initialize @tabs = [] @tab_contents = [] end |
Instance Method Details
#tab(method_name, tab_name, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
207 208 209 210 211 212 213 214 215 |
# File 'lib/aws-sdk-core/api/documenter.rb', line 207 def tab(method_name, tab_name, &block) tab_class = tab_name.downcase.gsub(/[^a-z]+/i, '-') tab_id = "#{method_name.to_s.gsub(/_/, '-')}-#{tab_class}" class_names = ['tab-contents', tab_class] @tabs << [tab_id, tab_name] @tab_contents << "<div class=\"#{class_names.join(' ')}\" id=\"#{tab_id}\">" @tab_contents << yield @tab_contents << '</div>' end |
#to_html ⇒ Object Also known as: inspect, to_str, to_s
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
217 218 219 220 221 222 223 224 225 226 227 228 |
# File 'lib/aws-sdk-core/api/documenter.rb', line 217 def to_html lines = [] lines << '<div class="tab-box">' lines << '<ul class="tabs">' @tabs.each do |tab_id, tab_name| lines << "<li data-tab-id=\"#{tab_id}\">#{tab_name}</li>" end lines << '</ul>' lines.concat(@tab_contents) lines << '</div>' lines.join end |