Parent

Class/Module Index [+]

Quicksearch

YARD::Templates::Section

Abstracts the structure for a section and its subsections into an ordered list of sections and subsections. @since 0.6.0

Attributes

name[RW]

Public Class Methods

new(name, *args) click to toggle source
# File lib/yard/templates/section.rb, line 9
def initialize(name, *args)
  self.name = name
  replace(parse_sections(args))
end

Public Instance Methods

<<(*args) click to toggle source
Alias for: push
==(other) click to toggle source
# File lib/yard/templates/section.rb, line 35
def ==(other)
  case other
  when Section
    eql?(other)
  when Array
    to_a == other
  else
    name == other
  end
end
[](*args) click to toggle source
# File lib/yard/templates/section.rb, line 20
def [](*args)
  if args.first.is_a?(Range) || args.size > 1
    obj = super(*args)
    obj.name = name
    return obj
  elsif args.first.is_a?(Integer)
    return super(*args)
  end
  find {|o| o.name == args.first }
end
any(item) click to toggle source
# File lib/yard/templates/section.rb, line 75
def any(item)
  find do |section|
    return section if section == item
    return section.any(item) unless section.empty?
  end
  nil
end
dup() click to toggle source
# File lib/yard/templates/section.rb, line 14
def dup
  obj = super
  obj.name = name
  obj
end
eql?(other) click to toggle source
# File lib/yard/templates/section.rb, line 31
def eql?(other)
  super(other) && name == other.name
end
inspect() click to toggle source
# File lib/yard/templates/section.rb, line 55
def inspect
  n = name.respond_to?(:path) ? "T('#{name.path}')" : name.inspect
  subsects = empty? ? "" : ", subsections=#{super}"
  "Section(#{n}#{subsects})"
end
place(*args) click to toggle source
# File lib/yard/templates/section.rb, line 61
def place(*args)
  super(*parse_sections(args))
end
push(*args) click to toggle source
# File lib/yard/templates/section.rb, line 46
def push(*args)
  super(*parse_sections(args))
end
Also aliased as: <<
to_a() click to toggle source
# File lib/yard/templates/section.rb, line 65
def to_a
  list = [name]
  unless empty?
    subsects = []
    each {|s| subsects += s.to_a }
    list << subsects
  end
  list
end
unshift(*args) click to toggle source
# File lib/yard/templates/section.rb, line 51
def unshift(*args)
  super(*parse_sections(args))
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.