xml2go 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
- string = string[0..-2]
50
- return [string, true]
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
 
@@ -1,3 +1,3 @@
1
1
  module Xml2go
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xml2go
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: