Class: RTFDoc::Scope
- Inherits:
-
Object
- Object
- RTFDoc::Scope
- Defined in:
- lib/rtfdoc.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#sections ⇒ Object
readonly
Returns the value of attribute sections.
Instance Method Summary collapse
- #generate_example ⇒ Object
-
#initialize(name, sections) ⇒ Scope
constructor
A new instance of Scope.
- #menu_output ⇒ Object
- #output ⇒ Object
Constructor Details
#initialize(name, sections) ⇒ Scope
Returns a new instance of Scope.
426 427 428 429 |
# File 'lib/rtfdoc.rb', line 426 def initialize(name, sections) @name = name @sections = sections end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
424 425 426 |
# File 'lib/rtfdoc.rb', line 424 def name @name end |
#sections ⇒ Object (readonly)
Returns the value of attribute sections.
424 425 426 |
# File 'lib/rtfdoc.rb', line 424 def sections @sections end |
Instance Method Details
#generate_example ⇒ Object
444 445 446 447 448 449 450 451 452 453 454 455 |
# File 'lib/rtfdoc.rb', line 444 def generate_example signatures = sections.each_with_object("") do |s, res| res << %(<div class="resource-sig">#{s.signature}</div>) end " <div class=\"section-response\">\n <div class=\"response-topbar\">\#{name} ENDPOINTS</div>\n <div class=\"section-endpoints\">\#{signatures}</div>\n </div>\n HTML\nend\n" |
#menu_output ⇒ Object
435 436 437 438 439 440 441 442 |
# File 'lib/rtfdoc.rb', line 435 def " <li>\n <div class=\"scope-title\">\#{name}</div>\n <ul class=\"scoped\">\#{sections.map(&:menu_output).join}</ul>\n </li>\n HTML\nend\n" |
#output ⇒ Object
431 432 433 |
# File 'lib/rtfdoc.rb', line 431 def output sections.map(&:output) end |