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.


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

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

Instance Method Details

#==(other) ⇒ Object

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


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

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


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

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


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

def values
  @values
end