Class: NexusParser::Tokens::RowVec
- Defined in:
- lib/nexus_parser/tokens.rb
Instance Attribute Summary
Attributes inherited from Token
Instance Method Summary collapse
-
#initialize(str) ⇒ RowVec
constructor
A new instance of RowVec.
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 |