Class: Hash

Inherits:
Object show all
Defined in:
lib/rgfa/field_writer.rb,
lib/rgfa/field_validator.rb

Instance Method Summary collapse

Instance Method Details

#default_gfa_datatypeRGFA::Line::FIELD_DATATYPE

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Optional field GFA datatype to use, if none is provided



65
# File 'lib/rgfa/field_writer.rb', line 65

def default_gfa_datatype; :J; end

#to_gfa_field(datatype: nil) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Representation of the data for GFA fields; this method does not (in general) validate the string. The method can be overwritten for a given class, and may take the #default_gfa_datatype into consideration.

Returns:



62
# File 'lib/rgfa/field_writer.rb', line 62

def to_gfa_field(datatype: nil); to_json; end

#validate_gfa_field!(datatype, fieldname = nil) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Validates the object according to the provided datatype

Parameters:

Raises:



104
105
106
107
108
109
110
111
# File 'lib/rgfa/field_validator.rb', line 104

def validate_gfa_field!(datatype, fieldname=nil)
  if datatype != :J
    raise RGFA::FieldParser::FormatError,
      "Wrong type (#{self.class}) for field #{fieldname}\n"+
      "Content: #{self.inspect}\n"+
      "Datatype: #{datatype}"
  end
end