lib/hqmf-generator/hqmf-generator.rb in hqmf-parser-1.0.6 vs lib/hqmf-generator/hqmf-generator.rb in hqmf-parser-1.1.0
- old
+ new
@@ -2,11 +2,11 @@
module Generator
def self.render_template(name, params)
template_path = File.expand_path(File.join('..', "#{name}.xml.erb"), __FILE__)
template_str = File.read(template_path)
- template = ERB.new(template_str, nil, '-', "_templ#{TemplateCounter.instance.new_id}")
+ template = ERB.new(template_str, nil, '-', "_templ#{HQMF::Counter.instance.next}")
context = ErbContext.new(params)
template.result(context.get_binding)
end
# Class to serialize HQMF::Document as HQMF V2 XML
@@ -286,23 +286,7 @@
raise "Unknown population criteria type #{population_criteria_code}"
end
end
end
- # Simple class to issue monotonically increasing integer identifiers
- class Counter
- def initialize
- @count = 0
- end
-
- def new_id
- @count+=1
- end
- end
-
- # Singleton to keep a count of template identifiers
- class TemplateCounter < Counter
- include Singleton
- end
-
end
end
\ No newline at end of file