Class: Fixnum

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



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

def default_gfa_datatype; :i; 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:



216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/rgfa/field_validator.rb', line 216

def validate_gfa_field!(datatype, fieldname=nil)
  if (datatype == :pos and self < 0)
    raise RGFA::FieldParser::FormatError,
      "Invalid content for field #{fieldname}\n"+
      "Content: #{self.inspect}\n"+
      "Datatype: #{datatype}"
  elsif ![:i, :f, :Z].include?(datatype)
    raise RGFA::FieldParser::FormatError,
        "Wrong type (#{self.class}) for field #{fieldname}\n"+
        "Content: #{self.inspect}\n"+
        "Datatype: #{datatype}"
  end
end