143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
# File 'lib/unitsml/utility.rb', line 143
def unit(units, formula, dims, norm_text, name, options)
attributes = {
id: unit_id(norm_text),
system: unitsystem(units),
name: unitname(units, norm_text, name),
symbol: unitsymbols(formula, options),
root_units: rootunits(units),
}
attributes[:dimension_url] = "##{dim_id(dims)}" if dims
Model::Unit.new(attributes).to_xml
.gsub("<", "<")
.gsub(">", ">")
.gsub("&", "&")
.gsub(/−/, "−")
.gsub(/⋅/, "⋅")
end
|