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.



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

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.



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

def known_tag
  @known_tag
end

Instance Method Details

#assign(ns) ⇒ Object



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

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