Class: Fog::Parsers::AWS::ELB::TagListParser
- Inherits:
-
Base
- Object
- Base
- Fog::Parsers::AWS::ELB::TagListParser
- Defined in:
- lib/fog/aws/parsers/elb/tag_list_parser.rb
Overview
parses an XML-formatted list of resource tags from AWS
Instance Method Summary collapse
- #end_element(name) ⇒ Object
-
#reset ⇒ Object
each tag is modeled as a String pair (2-element Array).
- #start_element(name, attrs = []) ⇒ Object
Instance Method Details
#end_element(name) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/fog/aws/parsers/elb/tag_list_parser.rb', line 30 def end_element(name) super case name when 'member' if @in_tags @tags[@this_key] = @this_value @this_key, @this_value = nil, nil else @response['DescribeTagsResult']['LoadBalancers'] << { 'Tags' => @tags, 'LoadBalancerName' => @load_balancer_name } end when 'Key' @this_key = value when 'Value' @this_value = value when 'LoadBalancerName' @load_balancer_name = value when 'RequestId' @response['ResponseMetadata'][name] = value when 'Tags' @in_tags = false end end |
#reset ⇒ Object
each tag is modeled as a String pair (2-element Array)
9 10 11 12 13 14 15 |
# File 'lib/fog/aws/parsers/elb/tag_list_parser.rb', line 9 def reset @this_key = nil @this_value = nil @tags = Hash.new @response = { 'DescribeTagsResult' => { 'LoadBalancers' => [] }, 'ResponseMetadata' => {} } @in_tags = false end |
#start_element(name, attrs = []) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fog/aws/parsers/elb/tag_list_parser.rb', line 17 def start_element(name, attrs = []) super case name when 'member' unless @in_tags @load_balancer_name = nil @tags = {} end when 'Tags' @in_tags = true end end |