Class: Bio::NeXML::Sequence
- Inherits:
-
Object
- Object
- Bio::NeXML::Sequence
- Includes:
- Mapper
- Defined in:
- lib/bio/db/nexml/matrix.rb
Constant Summary collapse
Instance Attribute Summary collapse
-
#id ⇒ Object
Because seq elements don’t have id attributes, we will use object_id in this case.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#each_value(&block) ⇒ Object
:yields: value.
-
#initialize(options = {}) ⇒ Sequence
constructor
A new instance of Sequence.
- #to_xml ⇒ Object
- #type ⇒ Object
Methods included from Mapper
Constructor Details
#initialize(options = {}) ⇒ Sequence
Returns a new instance of Sequence.
510 511 512 513 514 |
# File 'lib/bio/db/nexml/matrix.rb', line 510 def initialize( = {} ) properties( ) unless .empty? @id = self.object_id block.arity < 1 ? instance_eval( &block ) : block.call( self ) if block_given? end |
Instance Attribute Details
#id ⇒ Object
Because seq elements don’t have id attributes, we will use object_id in this case
508 509 510 |
# File 'lib/bio/db/nexml/matrix.rb', line 508 def id @id end |
#value ⇒ Object
Returns the value of attribute value.
504 505 506 |
# File 'lib/bio/db/nexml/matrix.rb', line 504 def value @value end |
Instance Method Details
#each_value(&block) ⇒ Object
:yields: value
521 522 523 524 525 526 527 |
# File 'lib/bio/db/nexml/matrix.rb', line 521 def each_value( &block ) # :yields: value if block_given? cells.each { |c| yield c.value } else enum_for( :each_value ) end end |
#to_xml ⇒ Object
529 530 531 532 533 |
# File 'lib/bio/db/nexml/matrix.rb', line 529 def to_xml node = @@writer.create_node( "seq" ) node << self.value node end |
#type ⇒ Object
516 517 518 519 |
# File 'lib/bio/db/nexml/matrix.rb', line 516 def type return nil if cells.empty? cells.first.bound? ? :granular : :raw end |