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.



255
256
257
258
259
# File 'lib/gfa/graph.rb', line 255

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



253
254
255
# File 'lib/gfa/graph.rb', line 253

def segment
  @segment
end

Class Method Details

.idx(segment, orient) ⇒ Object



246
247
248
249
250
# File 'lib/gfa/graph.rb', line 246

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



261
262
263
# File 'lib/gfa/graph.rb', line 261

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