Class: GFA::GraphVertex

Inherits:
Object
  • Object
show all
Defined in:
lib/gfa/graph.rb

Overview

:nodoc:

Constant Summary collapse

@@idx =

Class-level

{}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(segment, orient) ⇒ GraphVertex

Returns a new instance of GraphVertex.



89
90
91
92
93
# File 'lib/gfa/graph.rb', line 89

def initialize(segment, orient)
  @segment = segment.is_a?(GFA::Record::Segment) ? segment.name.value :
segment.is_a?(GFA::Field) ? segment.value : segment
  @orient  = orient.is_a?(GFA::Field) ? orient.value : orient
end

Instance Attribute Details

#segmentObject (readonly)

Instance-level



87
88
89
# File 'lib/gfa/graph.rb', line 87

def segment
  @segment
end

Class Method Details

.idx(segment, orient) ⇒ Object



80
81
82
83
84
# File 'lib/gfa/graph.rb', line 80

def self.idx(segment, orient)
  n = GFA::GraphVertex.new(segment, orient)
  @@idx[n.to_s] ||= n
  @@idx[n.to_s]
end

Instance Method Details

#to_sObject



95
96
97
# File 'lib/gfa/graph.rb', line 95

def to_s
  "#{segment}#{orient}"
end