Sha256: 666fd852cddd7de5d57012f83c7333a597cfab29088dfbf3a240143e6edda83d
Contents?: true
Size: 1.58 KB
Versions: 1
Compression:
Stored size: 1.58 KB
Contents
EXPERIAN_LIB_DIR = File.dirname(__FILE__) Dir["#{EXPERIAN_LIB_DIR}/element_numbers/*.rb"].each { |f| require(f) } module Experian class DataDictionary def self.lookup(column, key) column = column.to_s.downcase.gsub(/\s+/, '') key = key.to_s.strip self.send("en_#{column}", key) end def self.column_name(column) column = column.to_s.downcase.gsub(/\s+/, '') self.send("en_#{column}_column_name") end def self.value_description(column) column = column.to_s.downcase.gsub(/\s+/, '') self.send("en_#{column}_value_description") end def self.description(column) column = column.to_s.downcase.gsub(/\s+/, '') self.send("en_#{column}_description") end def self.method_missing(method, *args, &block) method_parts = method.to_s.split('_') if (2..3) === method_parts.size and method_parts[0] == 'en' column = method_parts[1] if /^[0-9]{1,3}$/ =~ column column = "%04d" % column new_method = method_parts.size == 3 ? "en_#{column}_description".to_sym : "en_#{column}".to_sym elsif /[a-z]$/ =~ column letters = column.match(/[a-z]+$/)[0] column = "%04d" % column.to_i new_method = method_parts.size == 3 ? "en_#{column}#{letters}_description".to_sym : "en_#{column}#{letters}".to_sym end if self.methods.include?(new_method) return self.send(new_method, *args, &block) else super(new_method, *args, &block) end else super(method, *args, &block) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
experian-data-dictionary-1.4.1 | lib/experian.rb |