From fcbf63e62c627deae76c1b8cb8c0876c536ed811 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Mon, 16 Mar 2020 18:49:26 +0900 Subject: Fresh start --- jni/ruby/lib/rdoc/markup/attr_span.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 jni/ruby/lib/rdoc/markup/attr_span.rb (limited to 'jni/ruby/lib/rdoc/markup/attr_span.rb') 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 + -- cgit v1.2.3