Class: RTFDoc::Group

Inherits:
Object
  • Object
show all
Defined in:
lib/rtfdoc.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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, options = {})
  @name       = name
  @resources  = resources

  sorted = true
  sorted = options['sort'] if options.key?('sort')
  @resources.sort! { |a, b| a.name <=> b.name } if sorted
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



396
397
398
# File 'lib/rtfdoc.rb', line 396

def name
  @name
end

#resourcesObject (readonly)

Returns the value of attribute resources.



396
397
398
# File 'lib/rtfdoc.rb', line 396

def resources
  @resources
end

Instance Method Details



411
412
413
414
415
416
417
418
419
420
# File 'lib/rtfdoc.rb', line 411

def menu_output
  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"

#outputObject



407
408
409
# File 'lib/rtfdoc.rb', line 407

def output
  resources.map(&:output)
end