122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
# File 'lib/elibri_onix_generator.rb', line 122
def initialize(products, options = {})
options.reverse_merge!({
:tags_type => :full,
:export_headers => true,
:elibri_onix_dialect => '3.0.1',
:comments => false,
:xml_variant => Elibri::XmlVariant::FULL_VARIANT
})
@xml_variant = options[:xml_variant]
raise ":xml_variant unspecified" if @xml_variant.blank? or !@xml_variant.kind_of?(::Elibri::XmlVariant)
@products = Array.wrap(products)
@tags_type = ActiveSupport::StringInquirer.new(options[:tags_type].to_s)
@comments = options[:comments]
@comment_kinds = options[:comment_kinds]
@out = []
@builder = Builder::XmlMarkup.new(:indent => 2, :target => @out)
@elibri_onix_dialect = options[:elibri_onix_dialect]
@pure_onix = options[:pure_onix]
if options[:export_headers]
self.class.(builder, :short_tags => tags_type.short?, :elibri_onix_dialect => @elibri_onix_dialect, :pure_onix => @pure_onix) do
render_products!
end
else
render_products!
end
end
|