Module: Clusta::Serialization::TSV::ClassMethods

Defined in:
lib/clusta/serialization/tsv.rb

Instance Method Summary collapse

Instance Method Details

#from_tsv_component_string(string) ⇒ Object

Raises:



71
72
73
74
75
76
77
# File 'lib/clusta/serialization/tsv.rb', line 71

def from_tsv_component_string string
  return string unless string.is_a?(String)
  args  = string.split(';')
  klass_name = args.shift
  raise ArgumentError.new("Elements instantiated from a TSV component string must match the format 'klass;[field1;[field2;]...]'") unless klass_name
  Wukong.class_from_resource(klass_name).new(*args)
end