polyrex 0.6.9 → 0.6.10
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/polyrex.rb +12 -4
- metadata +1 -1
    
        data/lib/polyrex.rb
    CHANGED
    
    | @@ -18,8 +18,14 @@ class Polyrex | |
| 18 18 | 
             
              end
         | 
| 19 19 |  | 
| 20 20 | 
             
              def create(id=nil)
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                if @id.to_s[/[0-9]/] then
         | 
| 23 | 
            +
                  @id = (@id.to_i + 1).to_s
         | 
| 24 | 
            +
                else
         | 
| 25 | 
            +
                  @id = XPath.first(@parent_node.root, 'count(//@id)').to_i + 2
         | 
| 26 | 
            +
                end
         | 
| 21 27 | 
             
                @create.id = id || @id
         | 
| 22 | 
            -
                 | 
| 28 | 
            +
                #@create.record = @parent_node
         | 
| 23 29 | 
             
                @create
         | 
| 24 30 | 
             
              end
         | 
| 25 31 |  | 
| @@ -29,7 +35,7 @@ class Polyrex | |
| 29 35 | 
             
              end
         | 
| 30 36 |  | 
| 31 37 | 
             
              def record()
         | 
| 32 | 
            -
                @ | 
| 38 | 
            +
                @create.record
         | 
| 33 39 | 
             
              end
         | 
| 34 40 |  | 
| 35 41 | 
             
              def to_xml()
         | 
| @@ -197,12 +203,13 @@ class Polyrex | |
| 197 203 | 
             
                  @recordx.shift
         | 
| 198 204 | 
             
                end
         | 
| 199 205 |  | 
| 200 | 
            -
                @id = XPath.match(@doc.root, '//@id').map{|x| x.value.to_i}.max.to_i | 
| 206 | 
            +
                @id = XPath.match(@doc.root, '//@id').map{|x| x.value.to_i}.max.to_i
         | 
| 201 207 |  | 
| 202 208 | 
             
                #puts 'schema : ' + schema
         | 
| 203 209 | 
             
                load_handlers(schema)
         | 
| 204 210 | 
             
                load_find_by(schema)
         | 
| 205 | 
            -
                @parent_node = XPath.first(@doc.root,'records')    
         | 
| 211 | 
            +
                @parent_node =  @doc.root #XPath.first(@doc.root,'records')    
         | 
| 212 | 
            +
                @create.record = @parent_node
         | 
| 206 213 |  | 
| 207 214 | 
             
              end
         | 
| 208 215 |  | 
| @@ -223,5 +230,6 @@ class Polyrex | |
| 223 230 |  | 
| 224 231 | 
             
                self.instance_eval methodx.join("\n")
         | 
| 225 232 | 
             
              end
         | 
| 233 | 
            +
             | 
| 226 234 |  | 
| 227 235 | 
             
            end
         |