Skip to content

Commit

Permalink
new deserializer: support MethodName and TypeName
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich Lane committed Nov 7, 2011
1 parent e89fa65 commit a8b6f60
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/rbvmomi/deserialization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class NewDeserializer

BUILTIN = Set.new %w(
xsd:string xsd:boolean xsd:short xsd:int xsd:long xsd:float xsd:dateTime xsd:base64Binary
KeyValue PropertyPath
KeyValue PropertyPath MethodName TypeName
)

def initialize conn
Expand All @@ -30,7 +30,7 @@ def deserialize node, type=nil

if BUILTIN.member? type
case type
when 'xsd:string', 'PropertyPath'
when 'xsd:string'
node.content
when 'xsd:boolean'
node.content == '1'
Expand All @@ -40,6 +40,8 @@ def deserialize node, type=nil
node.content.to_f
when 'xsd:dateTime'
leaf_date node
when 'PropertyPath', 'MethodName', 'TypeName'
node.content
when 'xsd:base64Binary'
leaf_binary node
when 'KeyValue'
Expand Down
12 changes: 12 additions & 0 deletions test/test_deserialization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -332,4 +332,16 @@ def test_array_mangling
</root>
EOS
end

def test_propertypath
check "<root>foo</root>", "foo", 'PropertyPath'
end

def test_methodname
check "<root>foo</root>", "foo", 'MethodName'
end

def test_typename
check "<root>foo</root>", "foo", 'TypeName'
end
end

0 comments on commit a8b6f60

Please sign in to comment.