Class: Bio::BioAlignment::Element

Inherits:
Object
  • Object
show all
Includes:
State
Defined in:
lib/bio-alignment/elements.rb

Overview

Simple element that can be queried

Constant Summary collapse

GAP =
'-'
UNDEFINED =
'X'

Instance Attribute Summary

Attributes included from State

#state

Instance Method Summary collapse

Constructor Details

#initialize(c) ⇒ Element

Returns a new instance of Element.



11
12
13
14
# File 'lib/bio-alignment/elements.rb', line 11

def initialize c
  @c = c
  @c.freeze
end

Instance Method Details

#==(other) ⇒ Object



24
25
26
# File 'lib/bio-alignment/elements.rb', line 24

def == other
  to_s == other.to_s
end

#cloneObject



27
28
29
30
31
32
33
# File 'lib/bio-alignment/elements.rb', line 27

def clone
  e = self.dup
  if e.state != nil
    e.state = e.state.clone
  end
  e
end

#gap?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/bio-alignment/elements.rb', line 15

def gap?
  @c == GAP
end

#to_sObject



21
22
23
# File 'lib/bio-alignment/elements.rb', line 21

def to_s
  @c
end

#undefined?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/bio-alignment/elements.rb', line 18

def undefined?
  @c == 'X'
end