Class: DataMetaDom::BitSet
- Inherits:
-
Mapping
- Object
- Documentable
- VerDoccable
- Mapping
- DataMetaDom::BitSet
- Defined in:
- lib/dataMetaDom/record.rb
Overview
A Bit Set mapping, one instance holding a set of references to the values packed tightly as a bit set.
Constant Summary
Constants inherited from Mapping
Instance Attribute Summary
Attributes inherited from Mapping
Attributes inherited from VerDoccable
Attributes inherited from Documentable
Class Method Summary collapse
-
.consumed?(model, src) ⇒ Boolean
Attempts to consume the instance from the given source, returns it if successful, returns nil otherwise.
Instance Method Summary collapse
-
#parse(src) ⇒ Object
Parses the current instance from the given source.
-
#sourceKeyWord ⇒ Object
Returns the keyword for this Mapping implementation, in this case “
bitset
”.
Methods inherited from Mapping
#[], #[]=, #initialize, #keys, #parseBase, #values
Methods inherited from VerDoccable
Methods inherited from Documentable
#addDoc, #all, #clear, #docConsumed?, #getDoc, #has?, #ids, #initialize
Constructor Details
This class inherits a constructor from DataMetaDom::Mapping
Class Method Details
.consumed?(model, src) ⇒ Boolean
Attempts to consume the instance from the given source, returns it if successful, returns nil otherwise.
-
Parameters
-
model
- an instance of a Model -
src
- an instance of SourceFile
-
104 105 106 107 |
# 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., src), $1)).parse(src)) : nil end |
Instance Method Details
#parse(src) ⇒ Object
Parses the current instance from the given source.
-
Parameters
-
src
- an instance of SourceFile
-
119 120 121 122 123 124 125 |
# 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 ⇒ Object
Returns the keyword for this Mapping implementation, in this case “bitset
”
112 |
# File 'lib/dataMetaDom/record.rb', line 112 def sourceKeyWord; BITSET end |