Class: SM::Attribute
- Inherits:
-
Object
- Object
- SM::Attribute
- Defined in:
- lib/rdoc/markup/simple_markup/inline.rb
Overview
We manage a set of attributes. Each attribute has a symbol name and a bit value
Constant Summary collapse
- SPECIAL =
1
- @@name_to_bitmap =
{ :_SPECIAL_ => SPECIAL }
- @@next_bitmap =
2
Class Method Summary collapse
Class Method Details
.as_string(bitmap) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/rdoc/markup/simple_markup/inline.rb', line 22 def Attribute.as_string(bitmap) return "none" if bitmap.zero? res = [] @@name_to_bitmap.each do |name, bit| res << name if (bitmap & bit) != 0 end res.join(",") end |
.bitmap_for(name) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/rdoc/markup/simple_markup/inline.rb', line 12 def Attribute.bitmap_for(name) bitmap = @@name_to_bitmap[name] if !bitmap bitmap = @@next_bitmap @@next_bitmap <<= 1 @@name_to_bitmap[name] = bitmap end bitmap end |