Class: MaRuKu::Out::EntityTable
- Inherits:
-
Object
- Object
- MaRuKu::Out::EntityTable
- Includes:
- Singleton
- Defined in:
- lib/maruku/output/entity_table.rb
Instance Method Summary collapse
- #each ⇒ Object
- #entity(name) ⇒ Object
-
#initialize ⇒ EntityTable
constructor
A new instance of EntityTable.
Constructor Details
#initialize ⇒ EntityTable
Returns a new instance of EntityTable.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/maruku/output/entity_table.rb', line 11 def initialize @entity_table = {} xml = File.new(File.join(File.dirname(__FILE__), '..', '..', '..', 'data', 'entities.xml')) doc = REXML::Document.new(xml) doc.elements.each("//char") do |c| num = c.attributes['num'].to_i name = c.attributes['name'] convert = c.attributes['convertTo'] package = c.attributes['package'] e = Entity.new(num, name, convert, package) @entity_table[name] = e @entity_table[num] = e end end |
Instance Method Details
#each ⇒ Object
32 33 34 |
# File 'lib/maruku/output/entity_table.rb', line 32 def each @entity_table.each end |
#entity(name) ⇒ Object
28 29 30 |
# File 'lib/maruku/output/entity_table.rb', line 28 def entity(name) @entity_table[name] end |