Class: Babeltrace2Gen::BTValueCLass::String

Inherits:
Scalar show all
Defined in:
lib/metababel/bt2_values_generator.rb

Constant Summary

Constants included from Babeltrace2Gen::BTPrinter

Babeltrace2Gen::BTPrinter::INDENT_INCREMENT

Instance Attribute Summary

Attributes inherited from Scalar

#name, #usr_default_value

Attributes inherited from Babeltrace2Gen::BTValueCLass

#cast_type

Instance Method Summary collapse

Methods inherited from Scalar

from_h, #get

Methods included from Babeltrace2Gen::BTPrinter

context, #name_sanitized, pr, #scope

Methods inherited from Babeltrace2Gen::BTValueCLass

from_h

Constructor Details

#initialize(name, usr_default_value) ⇒ String

Returns a new instance of String.



109
110
111
112
113
114
115
116
117
# File 'lib/metababel/bt2_values_generator.rb', line 109

def initialize(name, usr_default_value)
  bt_type = self.class.instance_variable_get(:@bt_type)
  # Every object that can be converted to string is being supported.
  if !usr_default_value.nil? and !usr_default_value.respond_to?(:to_s)
    raise "Bad default_value for '#{name}' in params.yaml, it must be #{bt_type} but provided '#{usr_default_value}'."
  end

  super(name, usr_default_value.to_s.inspect)
end