summaryrefslogtreecommitdiff
path: root/jni/ruby/lib/rdoc/markup/raw.rb
diff options
context:
space:
mode:
authorJari Vetoniemi <jari.vetoniemi@indooratlas.com>2020-03-16 18:49:26 +0900
committerJari Vetoniemi <jari.vetoniemi@indooratlas.com>2020-03-30 00:39:06 +0900
commitfcbf63e62c627deae76c1b8cb8c0876c536ed811 (patch)
tree64cb17de3f41a2b6fef2368028fbd00349946994 /jni/ruby/lib/rdoc/markup/raw.rb
Fresh start
Diffstat (limited to 'jni/ruby/lib/rdoc/markup/raw.rb')
-rw-r--r--jni/ruby/lib/rdoc/markup/raw.rb69
1 files changed, 69 insertions, 0 deletions
diff --git a/jni/ruby/lib/rdoc/markup/raw.rb b/jni/ruby/lib/rdoc/markup/raw.rb
new file mode 100644
index 0000000..e11e8ef
--- /dev/null
+++ b/jni/ruby/lib/rdoc/markup/raw.rb
@@ -0,0 +1,69 @@
+##
+# 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
+