Class: RTFDoc::Group
- Inherits:
-
Object
- Object
- RTFDoc::Group
- Defined in:
- lib/rtfdoc.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#resources ⇒ Object
readonly
Returns the value of attribute resources.
Instance Method Summary collapse
-
#initialize(name, resources, options = {}) ⇒ Group
constructor
A new instance of Group.
- #menu_output ⇒ Object
- #output ⇒ Object
Constructor Details
#initialize(name, resources, options = {}) ⇒ Group
Returns a new instance of Group.
398 399 400 401 402 403 404 405 |
# File 'lib/rtfdoc.rb', line 398 def initialize(name, resources, = {}) @name = name @resources = resources sorted = true sorted = ['sort'] if .key?('sort') @resources.sort! { |a, b| a.name <=> b.name } if sorted end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
396 397 398 |
# File 'lib/rtfdoc.rb', line 396 def name @name end |
#resources ⇒ Object (readonly)
Returns the value of attribute resources.
396 397 398 |
# File 'lib/rtfdoc.rb', line 396 def resources @resources end |
Instance Method Details
#menu_output ⇒ Object
411 412 413 414 415 416 417 418 419 420 |
# File 'lib/rtfdoc.rb', line 411 def title = "<h5 class=\"nav-group-title\">#{name}</h5>" if name && name.length > 0 " <div class=\"sidebar-nav-group\">\n \#{title}\n <ul>\#{resources.map(&:menu_output).join}</ul>\n </div>\n HTML\nend\n" |
#output ⇒ Object
407 408 409 |
# File 'lib/rtfdoc.rb', line 407 def output resources.map(&:output) end |