Class: Bio::NeXML::States
- Inherits:
-
Object
- Object
- Bio::NeXML::States
- Includes:
- Mapper, Enumerable
- Defined in:
- lib/bio/db/nexml/matrix.rb
Constant Summary collapse
Instance Attribute Summary collapse
-
#id ⇒ Object
A file level unique identifier.
-
#label ⇒ Object
A human readable description of the state.
Instance Method Summary collapse
-
#add_state(state) ⇒ Object
dummy for rdoc.
- #create_state(symbol = nil, options = {}) ⇒ Object
-
#delete_state(state) ⇒ Object
dummy for rdoc.
-
#each(&block) ⇒ Object
Iterate over each state set in
self
passing it to the block given. -
#each_char(state) ⇒ Object
dummy for rdoc.
-
#each_state(state) ⇒ Object
dummy for rdoc.
-
#get_state_by_id(state) ⇒ Object
dummy for rdoc.
- #get_state_by_symbol(symbol) ⇒ Object
-
#has_state?(state) ⇒ Boolean
dummy for rdoc.
- #include?(state) ⇒ Boolean
-
#initialize(id, options = {}) ⇒ States
constructor
A new instance of States.
- #to_xml ⇒ Object
Methods included from Mapper
Constructor Details
#initialize(id, options = {}) ⇒ States
Returns a new instance of States.
171 172 173 174 175 |
# File 'lib/bio/db/nexml/matrix.rb', line 171 def initialize( id, = {} ) @id = id 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.
158 159 160 |
# File 'lib/bio/db/nexml/matrix.rb', line 158 def id @id end |
#label ⇒ Object
A human readable description of the state.
161 162 163 |
# File 'lib/bio/db/nexml/matrix.rb', line 161 def label @label end |
Instance Method Details
#add_state(state) ⇒ Object
dummy for rdoc
183 |
# File 'lib/bio/db/nexml/matrix.rb', line 183 def add_state( state ); end |
#create_state(symbol = nil, options = {}) ⇒ Object
177 178 179 180 181 |
# File 'lib/bio/db/nexml/matrix.rb', line 177 def create_state( symbol = nil, = {} ) state = State.new( Bio::NeXML.generate_id( State ), symbol, ) add_state( state ) state end |
#delete_state(state) ⇒ Object
dummy for rdoc
185 |
# File 'lib/bio/db/nexml/matrix.rb', line 185 def delete_state( state ); end |
#each(&block) ⇒ Object
Iterate over each state set in self
passing it to the block given. If no block is provided, it returns an Enumerator.
206 207 208 |
# File 'lib/bio/db/nexml/matrix.rb', line 206 def each( &block ) @states.each( &block ) end |
#each_char(state) ⇒ Object
dummy for rdoc
193 |
# File 'lib/bio/db/nexml/matrix.rb', line 193 def each_char( state ); end |
#each_state(state) ⇒ Object
dummy for rdoc
191 |
# File 'lib/bio/db/nexml/matrix.rb', line 191 def each_state( state ); end |
#get_state_by_id(state) ⇒ Object
dummy for rdoc
189 |
# File 'lib/bio/db/nexml/matrix.rb', line 189 def get_state_by_id( state ); end |
#get_state_by_symbol(symbol) ⇒ Object
199 200 201 202 |
# File 'lib/bio/db/nexml/matrix.rb', line 199 def get_state_by_symbol( symbol ) matches = each_state.select{ |s| s.symbol == symbol } matches.first end |
#has_state?(state) ⇒ Boolean
dummy for rdoc
187 |
# File 'lib/bio/db/nexml/matrix.rb', line 187 def has_state?( state ); end |
#include?(state) ⇒ Boolean
195 196 197 |
# File 'lib/bio/db/nexml/matrix.rb', line 195 def include?( state ) has_state?( state ) end |
#to_xml ⇒ Object
210 211 212 213 214 215 216 |
# File 'lib/bio/db/nexml/matrix.rb', line 210 def to_xml node = @@writer.create_node( "states", @@writer.attributes( self, :id, :label ) ) self.each_state do |state| node << state.to_xml end node end |