Sha256: 6c38eda74d059f06af3468023ea6236100ffdcf8ad4fc7603a41dc879e588b1b
Contents?: true
Size: 1.42 KB
Versions: 6
Compression:
Stored size: 1.42 KB
Contents
require 'ncs_navigator/mdes' module NcsNavigator::Mdes ## # One table in the MDES. class TransmissionTable ## # Creates a new instance from an `xs:element` describing the table. # # @return [TransmissionTable] the created instance. def self.from_element(element, options={}) log = options[:log] || NcsNavigator::Mdes.default_logger new(element['name']).tap do |table| table.variables = element. xpath('xs:complexType/xs:sequence/xs:element', SourceDocuments.xmlns). collect { |col_elt| Variable.from_element(col_elt, options) } end end ## # @return [String] the machine name of the table. This is also the name of the XML # element in the VDR export. attr_reader :name ## # @return [Array<Variable>] the variables that make up this # table. (A relational model might call these the columns of this # table.) attr_accessor :variables def initialize(name) @name = name end ## # Search for a variable by name. # # @param variable_name [String] the name of the variable to look for. # @return [Variable] the variable with the given name, if any def [](variable_name) variables.find { |c| c.name == variable_name } end ## # Provides a briefer inspection for cleaner IRB use. # # @return [String] def inspect "\#<#{self.class} name=#{name.inspect}>" end end end
Version data entries
6 entries across 6 versions & 1 rubygems