Method: IniFile::Parser#parse_value
- Defined in:
- lib/inifile.rb
#parse_value(string) ⇒ Object
Given a string, attempt to parse out a value from that string. This value might be continued on the following line. So this method returns ‘true` if it is expecting more data.
string - String to parse
Returns ‘true` if the next line is also part of the current value. Returns `fase` if the string contained a complete value.
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 |
# File 'lib/inifile.rb', line 453 def parse_value( string ) continuation = false # if our value starts with a double quote, then we are in a # line continuation situation if leading_quote? # check for a closing quote at the end of the string if string =~ @close_quote value << $1 # otherwise just append the string to the value else value << string continuation = true end # not currently processing a continuation line else case string when @full_quote self.value = $1 when @open_quote self.value = $1 continuation = true when @trailing_slash self.value ? self.value << $1 : self.value = $1 continuation = true when @normal_value self.value ? self.value << $1 : self.value = $1 else error end end if continuation self.value << $/ if leading_quote? else process_property end continuation end |