Class: NexusParser::Tokens::ValuePair

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

Overview

note we grab EOL and ; here

Instance Attribute Summary

Attributes inherited from Token

#value

Instance Method Summary collapse

Constructor Details

#initialize(str) ⇒ ValuePair

Returns a new instance of ValuePair.



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

def initialize(str)
  str.strip!
  str = str.split(/=/)
  str[1].strip!
  str[1] = str[1][1..-2] if str[1][0..0] == "'"
  str[1] = str[1][1..-2] if str[1][0..0] ==  "\""
  @value = {str[0].strip.downcase.to_sym => str[1].strip}
end