Class: D3MPQ::Attributes

Inherits:
Object
  • Object
show all
Defined in:
lib/d3_mpq/attributes.rb

Defined Under Namespace

Classes: Attribute

Instance Method Summary collapse

Constructor Details

#initialize(path = nil) ⇒ Attributes

Returns a new instance of Attributes.



11
12
13
# File 'lib/d3_mpq/attributes.rb', line 11

def initialize(path = nil)
  read(path) if path
end

Instance Method Details

#contentObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/d3_mpq/attributes.rb', line 24

def content
  return @content if @content

  @content = []
  entries.each do |e|
    a = Attribute.new
    a.id            = e["Id"]
    a.u2            = e["U2"]
    a.u3            = e["U3"]
    a.u4            = e["U4"]
    a.u5            = e["U5"]
    a.script_a      = e["ScriptA"]
    a.script_b      = e["ScriptB"]
    a.name          = e["Name"]
    a.encoding_type = e["EncodingType"]
    a.u10           = e["U10"]
    a.min           = e["Min"]
    a.max           = e["Max"]
    a.bit_count     = e["BitCount"]

    @content << a
  end

  return @content
end

#read(path) ⇒ Object



15
16
17
# File 'lib/d3_mpq/attributes.rb', line 15

def read(path)
  @doc = Nokogiri::XML(File.open(path))
end

#snapshotObject

HACK: to get the analyzer working



20
21
22
# File 'lib/d3_mpq/attributes.rb', line 20

def snapshot
  {:content => content}
end