module RGFA::FieldWriter
Methods to convert ruby objects to the GFA string representations @api private
The default conversion is implemented in this module, which is included in Object
; single classes may overwrite the following methods, if necessary:
-
{#default_gfa_datatype}, which returns the symbol of the optional field GFA datatype to use, if none is specified (See RGFA::Line::FIELD_DATATYPE); the default is :Z
-
{#to_gfa_field} should return a GFA string representation, eventually depending on the specified datatype; no validation is done; the default is to_s
Public Instance Methods
@!macro [new] gfa_datatype
Optional field GFA datatype to use, if none is provided @return [RGFA::Line::FIELD_DATATYPE] @api private
# File lib/rgfa/field_writer.rb, line 43 def default_gfa_datatype; :Z; end
@!macro [new] to_gfa_field
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. @return [String] @api private
# File lib/rgfa/field_writer.rb, line 28 def to_gfa_field(datatype: nil); to_s; end
Representation of the data as an optional field @param fieldname [Symbol] the tag name @param datatype [RGFA::Line::OPTFIELD_DATATYPE] (<i>defaults to: the value
returned by {#default_gfa_datatype}</i>)
@api private
# File lib/rgfa/field_writer.rb, line 35 def to_gfa_optfield(fieldname, datatype: default_gfa_datatype) return "#{fieldname}:#{datatype}:#{to_gfa_field(datatype: datatype)}" end