Class: Bio::GFF::GFF2::Record::Value

Inherits:
Object
  • Object
show all
Includes:
Escape
Defined in:
lib/bio/db/gff.rb

Overview

Stores GFF2 attribute’s value.

Constant Summary

Constants included from Escape

Escape::BACKSLASH, Escape::CHAR2BACKSLASH, Escape::CHAR2BACKSLASH_EXTENDED, Escape::IDENTIFIER_GFF2, Escape::NUMERIC_GFF2, Escape::PROHIBITED_GFF2_COLUMNS, Escape::PROHIBITED_GFF2_TAGS, Escape::UNSAFE_GFF2

Instance Method Summary collapse

Constructor Details

#initialize(values = []) ⇒ Value

Creates a new Value object. Note that the given array values is directly stored in the object.


Arguments:

  • (optional) values: Array containing String objects.

Returns

Value object.



326
327
328
# File 'lib/bio/db/gff.rb', line 326

def initialize(values = [])
  @values = values
end

Instance Method Details

#==(other) ⇒ Object

Returns true if other == self. Otherwise, returns false.



352
353
354
355
356
# File 'lib/bio/db/gff.rb', line 352

def ==(other)
  return false unless other.kind_of?(self.class) or
    self.kind_of?(other.class)
  self.values == other.values rescue super(other)
end

#to_sObject

Returns string representation of this Value object.


Returns

String



333
334
335
336
337
# File 'lib/bio/db/gff.rb', line 333

def to_s
  @values.collect do |str|
    escape_gff2_attribute_value(str)
  end.join(' ')
end

#valuesObject Also known as: to_a

Returns all values in this object.

Note that modification of the returned array would affect original Value object.


Returns

Array



345
346
347
# File 'lib/bio/db/gff.rb', line 345

def values
  @values
end