Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

Changeset 1732

Show
Ignore:
Timestamp:
10/03/06 22:13:33 (2 years ago)
Author:
nahi
Message:

NamedElement#uniq? did not work. closes #271.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/xsd/namedelements.rb

    r1644 r1732  
    7474    o = NamedElements.new 
    7575    o.elements = @elements + rhs.elements 
     76    @cache.clear 
    7677    o 
    7778  end 
     
    8586  def uniq 
    8687    o = NamedElements.new 
    87     o.elements = @elements.uniq 
     88    o.elements = uniq_elements 
    8889    o 
    8990  end 
    9091 
    9192  def uniq! 
    92     @elements.uniq! 
     93    @elements.replace(uniq_elements) 
     94    @cache.clear 
    9395  end 
    9496 
     
    104106    @elements 
    105107  end 
     108 
     109private 
     110 
     111  def uniq_elements 
     112    dict = {} 
     113    elements = [] 
     114    @elements.each do |ele| 
     115      unless dict.key?(ele.name) 
     116        dict[ele.name] = ele 
     117        elements << ele 
     118      end 
     119    end 
     120    elements 
     121  end 
    106122end 
    107123