Class: Babeltrace2Gen::BTValueCLass
- Inherits:
-
Object
- Object
- Babeltrace2Gen::BTValueCLass
- Defined in:
- lib/metababel/bt2_values_generator.rb
Defined Under Namespace
Classes: Bool, IntegerUnsigned, Map, Scalar, String
Instance Attribute Summary collapse
-
#cast_type ⇒ Object
Returns the value of attribute cast_type.
Class Method Summary collapse
Instance Attribute Details
#cast_type ⇒ Object
Returns the value of attribute cast_type.
5 6 7 |
# File 'lib/metababel/bt2_values_generator.rb', line 5 def cast_type @cast_type end |
Class Method Details
.from_h(model) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/metababel/bt2_values_generator.rb', line 7 def self.from_h(model) key = model.delete(:type) raise "No type in #{model}" unless key h = { 'map' => BTValueCLass::Map, 'string' => BTValueCLass::String, 'bool' => BTValueCLass::Bool, 'integer_unsigned' => BTValueCLass::IntegerUnsigned }.freeze raise "Type #{key} not supported" unless h.include?(key) cast_type = model.delete(:cast_type) fc = h[key].from_h(model) fc.cast_type = cast_type if cast_type fc end |