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.



104
105
106
107
108
109
110
111
# File 'lib/nexus_parser/tokens.rb', line 104

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