1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/lib/rdoc/markup/raw.rb
drbrain 1c279a7d27 * lib/rdoc*: Updated to RDoc 4.0 (pre-release)
* bin/rdoc:  ditto
* test/rdoc:  ditto
* NEWS:  Updated with RDoc 4.0 information


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-27 04:28:14 +00:00

69 lines
970 B
Ruby

##
# A section of text that is added to the output document as-is
class RDoc::Markup::Raw
##
# The component parts of the list
attr_reader :parts
##
# Creates a new Raw containing +parts+
def initialize *parts
@parts = []
@parts.concat parts
end
##
# Appends +text+
def << text
@parts << text
end
def == other # :nodoc:
self.class == other.class and @parts == other.parts
end
##
# Calls #accept_raw+ on +visitor+
def accept visitor
visitor.accept_raw self
end
##
# Appends +other+'s parts
def merge other
@parts.concat other.parts
end
def pretty_print q # :nodoc:
self.class.name =~ /.*::(\w{1,4})/i
q.group 2, "[#{$1.downcase}: ", ']' do
q.seplist @parts do |part|
q.pp part
end
end
end
##
# Appends +texts+ onto this Paragraph
def push *texts
self.parts.concat texts
end
##
# The raw text
def text
@parts.join ' '
end
end