summaryrefslogtreecommitdiff
path: root/jni/ruby/lib/rdoc/markup/attr_span.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/attr_span.rb
Fresh start
Diffstat (limited to 'jni/ruby/lib/rdoc/markup/attr_span.rb')
-rw-r--r--jni/ruby/lib/rdoc/markup/attr_span.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/jni/ruby/lib/rdoc/markup/attr_span.rb b/jni/ruby/lib/rdoc/markup/attr_span.rb
new file mode 100644
index 0000000..b5c1b3b
--- /dev/null
+++ b/jni/ruby/lib/rdoc/markup/attr_span.rb
@@ -0,0 +1,29 @@
+##
+# An array of attributes which parallels the characters in a string.
+
+class RDoc::Markup::AttrSpan
+
+ ##
+ # Creates a new AttrSpan for +length+ characters
+
+ def initialize(length)
+ @attrs = Array.new(length, 0)
+ end
+
+ ##
+ # Toggles +bits+ from +start+ to +length+
+ def set_attrs(start, length, bits)
+ for i in start ... (start+length)
+ @attrs[i] |= bits
+ end
+ end
+
+ ##
+ # Accesses flags for character +n+
+
+ def [](n)
+ @attrs[n]
+ end
+
+end
+