PHP 8.2.31
Preview: list.rb Size: 1.08 KB
//proc/thread-self/root/opt/alt/ruby19/lib64/ruby/1.9.1/rdoc/markup/list.rb

##
# A List of ListItems

class RDoc::Markup::List

  ##
  # The list's type

  attr_accessor :type

  ##
  # Items in the list

  attr_reader :items

  ##
  # Creates a new list of +type+ with +items+

  def initialize type = nil, *items
    @type = type
    @items = []
    @items.push(*items)
  end

  ##
  # Appends +item+ to the list

  def << item
    @items << item
  end

  def == other # :nodoc:
    self.class == other.class and
      @type == other.type and
      @items == other.items
  end

  ##
  # Runs this list and all its #items through +visitor+

  def accept visitor
    visitor.accept_list_start self

    @items.each do |item|
      item.accept visitor
    end

    visitor.accept_list_end self
  end

  ##
  # Is the list empty?

  def empty?
    @items.empty?
  end

  ##
  # Returns the last item in the list

  def last
    @items.last
  end

  def pretty_print q # :nodoc:
    q.group 2, "[list: #{@type} ", ']' do
      q.seplist @items do |item|
        q.pp item
      end
    end
  end

  ##
  # Appends +items+ to the list

  def push *items
    @items.push(*items)
  end

end

Directory Contents

Dirs: 0 × Files: 24

Name Size Perms Modified Actions
7.80 KB lrw-r--r-- 2011-02-02 00:32:30
Edit Download
361 B lrw-r--r-- 2010-12-20 03:22:49
Edit Download
2.42 KB lrw-r--r-- 2011-08-05 21:21:55
Edit Download
3.30 KB lrw-r--r-- 2011-08-24 00:02:17
Edit Download
15.71 KB lrw-r--r-- 2011-06-16 04:59:24
Edit Download
314 B lrw-r--r-- 2011-02-02 00:32:30
Edit Download
534 B lrw-r--r-- 2011-06-16 04:59:24
Edit Download
2.76 KB lrw-r--r-- 2011-06-28 02:28:25
Edit Download
1.08 KB lrw-r--r-- 2010-12-20 03:22:49
Edit Download
1.26 KB lrw-r--r-- 2010-12-20 03:22:49
Edit Download
191 B lrw-r--r-- 2010-12-20 03:22:49
Edit Download
12.65 KB lrw-r--r-- 2011-08-05 21:21:55
Edit Download
6.33 KB lrw-r--r-- 2011-08-05 21:21:55
Edit Download
965 B lrw-r--r-- 2010-12-20 03:22:49
Edit Download
285 B lrw-r--r-- 2010-12-20 03:22:49
Edit Download
2.53 KB lrw-r--r-- 2011-05-15 11:55:52
Edit Download
1.79 KB lrw-r--r-- 2011-06-28 02:28:25
Edit Download
1.70 KB lrw-r--r-- 2011-06-16 04:59:24
Edit Download
6.66 KB lrw-r--r-- 2011-08-24 00:02:17
Edit Download
3.34 KB lrw-r--r-- 2011-08-05 21:21:55
Edit Download
5.58 KB lrw-r--r-- 2011-06-16 04:59:24
Edit Download
1.16 KB lrw-r--r-- 2011-06-16 04:59:24
Edit Download
2.11 KB lrw-r--r-- 2011-06-16 04:59:24
Edit Download
634 B lrw-r--r-- 2010-12-20 03:22:49
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).