class FIXSpec::DataDictionary
Attributes
fileName[R]
Public Class Methods
new(fileName)
click to toggle source
Calls superclass method
# File lib/fix_spec/data_dictionary.rb, line 9 def initialize(fileName) @fileName = fileName super(@fileName) end
Public Instance Methods
get_reverse_value_name(tag, name)
click to toggle source
# File lib/fix_spec/data_dictionary.rb, line 19 def get_reverse_value_name(tag, name) if(reverse_lookup[tag].has_key?(name)) reverse_lookup[tag][name] else name end end
reverse_lookup()
click to toggle source
# File lib/fix_spec/data_dictionary.rb, line 15 def reverse_lookup @reverse_lookup ||= parse_xml end
Private Instance Methods
parse_xml()
click to toggle source
# File lib/fix_spec/data_dictionary.rb, line 29 def parse_xml lookup = {} doc = REXML::Document.new File.new(@fileName) doc.elements.each("fix/fields/field") do |f| tag = f.attributes['number'].to_i lookup[tag]||={} f.elements.each("value") do |v| lookup[ tag ][v.attributes['description'] ] = v.attributes['enum'] end end #also map pretty msg type names doc.elements.each("fix/messages/message") do |m| lookup[35][m.attributes['name']] = m.attributes['msgtype'] end lookup end