Class: PG::AWS_RDS_IAM::ConnectionInfo::KeywordValueString::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/pg/aws_rds_iam/connection_info/keyword_value_string.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection_string) ⇒ Parser

Returns a new instance of Parser.



39
40
41
# File 'lib/pg/aws_rds_iam/connection_info/keyword_value_string.rb', line 39

def initialize(connection_string)
  @buffer = StringScanner.new(connection_string)
end

Instance Method Details

#parseObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/pg/aws_rds_iam/connection_info/keyword_value_string.rb', line 44

def parse
  result = {}

  skip_whitespace
  until @buffer.eos?
    key = parse_key
    skip_whitespace
    assert_followed_by_equals_sign key
    skip_whitespace
    value = parse_value
    skip_whitespace

    result[key] = value
  end

  @buffer.reset
  result
end