Class: NexusParser::Tokens::RowVec

Inherits:
Token
  • Object
show all
Defined in:
lib/nexus_parser/tokens.rb

Instance Attribute Summary

Attributes inherited from Token

#value

Instance Method Summary collapse

Constructor Details

#initialize(str) ⇒ RowVec

Returns a new instance of RowVec.



120
121
122
123
124
125
# File 'lib/nexus_parser/tokens.rb', line 120

def initialize(str)
  # meh! Ruby is simpler to read than Perl?
  # handles both () and {} style multistates
  s = str.split(/\(|\)|\}|\{/).collect{|s| s=~ /[\,|\s]/ ? s.split(/[\,|\s]/) : s}.inject([]){|sum, x| x.class == Array ? sum << x.delete_if {|y| y == "" } : sum + x.strip.split(//)}
  @value = s
end