Class: Fixnum
- Defined in:
- lib/rgfa/field_writer.rb,
lib/rgfa/field_validator.rb
Instance Method Summary collapse
-
#default_gfa_datatype ⇒ RGFA::Line::FIELD_DATATYPE
private
Optional field GFA datatype to use, if none is provided.
-
#validate_gfa_field!(datatype, fieldname = nil) ⇒ void
private
Validates the object according to the provided datatype.
Instance Method Details
#default_gfa_datatype ⇒ RGFA::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
230 231 232 233 234 235 236 237 238 239 240 241 242 |
# File 'lib/rgfa/field_validator.rb', line 230 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 |