class DataMetaDom::Mappings

A single-value map of a key to a value.

Public Class Methods

consumed?(model, src) click to toggle source

Attempts to consume the instance from the given source, returns it if successful, returns nil otherwise.

  • Parameters

# File lib/dataMetaDom/record.rb, line 139
def self.consumed?(model, src)
    src.line =~ /^\s*#{MAPPING}\s+(\w+)\s+.+$/ ? model.addEnum(Mappings.new(DataMetaDom.combineNsBase(
            DataMetaDom.nsAdjustment(src.namespace, model.options, src), $1)).parse(src)) : nil
end

Public Instance Methods

parse(src) click to toggle source

Parses the current instance from the given source.

# File lib/dataMetaDom/record.rb, line 154
def parse(src)
    r = src.line.scan(/^\s*\w+\s+\w+\s+(\S+)\s+(\S+)\s*$/)
    raise 'Invalid map specification' unless r && r[0] && r[0][0] && r[0][1]
    self.fromT = DataType.parse(src, r[0][0])
    self.toT = DataType.parse(src, r[0][1])
    parseBase src
end
sourceKeyWord() click to toggle source

Returns the keyword for this Mapping implementation, in this case “map

# File lib/dataMetaDom/record.rb, line 147
def sourceKeyWord; MAPPING end