Class: Bio::NeXML::Char
- Inherits:
-
Object
- Object
- Bio::NeXML::Char
- Includes:
- Mapper
- Defined in:
- lib/bio/db/nexml/matrix.rb
Overview
A char specifies which states apply to matrix columns.
Constant Summary collapse
Instance Attribute Summary collapse
-
#id ⇒ Object
A file level unique identifier.
-
#label ⇒ Object
A human readable description.
Instance Method Summary collapse
-
#initialize(id, states = nil, options = {}) ⇒ Char
constructor
A new instance of Char.
- #to_xml ⇒ Object
Methods included from Mapper
Constructor Details
#initialize(id, states = nil, options = {}) ⇒ Char
Returns a new instance of Char.
138 139 140 141 142 143 144 145 |
# File 'lib/bio/db/nexml/matrix.rb', line 138 def initialize( id, states = nil, = {} ) @id = id unless states.nil? states.is_a?( Hash ) ? = states : self.states = states end properties( ) unless .empty? block.arity < 1 ? instance_eval( &block ) : block.call( self ) if block_given? end |
Instance Attribute Details
#id ⇒ Object
A file level unique identifier.
126 127 128 |
# File 'lib/bio/db/nexml/matrix.rb', line 126 def id @id end |
#label ⇒ Object
A human readable description.
129 130 131 |
# File 'lib/bio/db/nexml/matrix.rb', line 129 def label @label end |
Instance Method Details
#to_xml ⇒ Object
147 148 149 |
# File 'lib/bio/db/nexml/matrix.rb', line 147 def to_xml @@writer.create_node( "char", @@writer.attributes( self, :id, :states, :label, :codon ) ) end |