xml2go 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/xml2go/parser.rb +4 -10
- data/lib/xml2go/version.rb +1 -1
- metadata +1 -1
data/lib/xml2go/parser.rb
CHANGED
@@ -44,11 +44,11 @@ module Xml2Go
|
|
44
44
|
|
45
45
|
# take 's' out of string and return if it was plural or not
|
46
46
|
def singularize(string)
|
47
|
-
return [string, false]
|
48
47
|
if string[-1] == "s" then
|
49
|
-
|
50
|
-
return [
|
48
|
+
s = string[0..-2]
|
49
|
+
return [s, true]
|
51
50
|
end
|
51
|
+
return [string, false]
|
52
52
|
end
|
53
53
|
|
54
54
|
def get_struct_member(element)
|
@@ -62,13 +62,7 @@ module Xml2Go
|
|
62
62
|
if struct.fields.has_key?(var_name) &&
|
63
63
|
!struct.fields[var_name].type.include?("[]") then
|
64
64
|
|
65
|
-
type = struct.fields[var_name].type
|
66
|
-
# Ignore the 's' at the end
|
67
|
-
if type[-1] == "s" then
|
68
|
-
# update the struct
|
69
|
-
@structs[type].name = type[0..-2]
|
70
|
-
type = type[0..-2]
|
71
|
-
end
|
65
|
+
type, sing = singularize(struct.fields[var_name].type)
|
72
66
|
|
73
67
|
struct.fields[var_name].type = "[]" + type
|
74
68
|
|
data/lib/xml2go/version.rb
CHANGED