Class: Lwes::Serialization::Attribute
- Inherits:
-
BinData::Primitive
- Object
- BinData::Primitive
- Lwes::Serialization::Attribute
- Defined in:
- lib/lwes/serialization.rb
Instance Method Summary collapse
- #assign(val) ⇒ Object
- #extract_key(val) ⇒ Object
- #extract_type(val) ⇒ Object
- #extract_value(val) ⇒ Object
- #get ⇒ Object
- #set(val) ⇒ Object
Instance Method Details
#assign(val) ⇒ Object
137 138 139 140 |
# File 'lib/lwes/serialization.rb', line 137 def assign(val) super self.val = extract_value(val) end |
#extract_key(val) ⇒ Object
142 143 144 |
# File 'lib/lwes/serialization.rb', line 142 def extract_key(val) val[0] end |
#extract_type(val) ⇒ Object
146 147 148 |
# File 'lib/lwes/serialization.rb', line 146 def extract_type(val) Lwes::TYPE_TO_BYTE[val[1]] end |
#extract_value(val) ⇒ Object
150 151 152 |
# File 'lib/lwes/serialization.rb', line 150 def extract_value(val) val[2] end |
#get ⇒ Object
154 155 156 |
# File 'lib/lwes/serialization.rb', line 154 def get [self.key, BYTE_TO_TYPE[self.vtype], self.val] end |
#set(val) ⇒ Object
158 159 160 161 162 |
# File 'lib/lwes/serialization.rb', line 158 def set(val) self.key = extract_key(val) self.vtype = extract_type(val) self.val = extract_value(val) end |