class DataMetaDom::BitSet
A Bit Set mapping, one instance holding a set of references to the values packed tightly as a bit set.
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
-
model
- an instance of aModel
-
src
- an instance ofSourceFile
-
# File lib/dataMetaDom/record.rb, line 104 def self.consumed?(model, src) src.line =~ /^\s*#{BITSET}\s+(\w+)\s+.+$/ ? model.addEnum(BitSet.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.
-
Parameters
-
src
- an instance ofSourceFile
-
# File lib/dataMetaDom/record.rb, line 119 def parse(src) r = src.line.scan(/^\s*\w+\s+\w+\s+(\S+)\s*$/) raise 'Invalid bitset specification' unless r && r[0] && r[0][0] self.fromT = INT4 #platform type is up to the concrete generator self.toT = DataType.parse(src, r[0][0]) parseBase src end
sourceKeyWord()
click to toggle source
Returns the keyword for this Mapping
implementation, in this case “bitset
”
# File lib/dataMetaDom/record.rb, line 112 def sourceKeyWord; BITSET end