Class: XSD::NS::Assigner

Inherits:
Object show all
Defined in:
lib/xsd/ns.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(known_tag) ⇒ Assigner

Returns a new instance of Assigner.



27
28
29
30
# File 'lib/xsd/ns.rb', line 27

def initialize(known_tag)
  @known_tag = known_tag.dup
  @count = 0
end

Instance Attribute Details

#known_tagObject (readonly)

Returns the value of attribute known_tag.



25
26
27
# File 'lib/xsd/ns.rb', line 25

def known_tag
  @known_tag
end

Instance Method Details

#assign(ns) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/xsd/ns.rb', line 32

def assign(ns)
  if @known_tag.key?(ns)
    return @known_tag[ns]
  end
  @count += 1
  "n#{@count}"
end