Class: Aws::Api::Docs::Builder::Tabulator Private
- Inherits:
-
Object
- Object
- Aws::Api::Docs::Builder::Tabulator
- Defined in:
- lib/aws-sdk-core/api/docs/builder.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.
183 184 185 186 |
# File 'lib/aws-sdk-core/api/docs/builder.rb', line 183 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.
188 189 190 191 192 193 194 195 196 |
# File 'lib/aws-sdk-core/api/docs/builder.rb', line 188 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.
198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/aws-sdk-core/api/docs/builder.rb', line 198 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 |