Module: GSA::XMLizer
Instance Method Summary collapse
-
#attributor(attributes) ⇒ Object
for creating attributes on tags.
-
#block(tag, value, attributes = {}) ⇒ Object
for container tags.
-
#tag(tag, attributes = {}) ⇒ Object
for single-line tags.
- #xml(content) ⇒ Object
Methods included from Injector
Instance Method Details
#attributor(attributes) ⇒ Object
for creating attributes on tags
20 21 22 |
# File 'lib/gsa/modules/xmlizer.rb', line 20 def attributor(attributes) inject_s(attributes) {|key, value| " #{key.to_s}=\"#{value.to_s}\""} end |
#block(tag, value, attributes = {}) ⇒ Object
for container tags
15 16 17 |
# File 'lib/gsa/modules/xmlizer.rb', line 15 def block(tag, value, attributes={}) "<#{tag.to_s}#{attributor(attributes)}>\n" << value.to_s << "</#{tag.to_s}>\n" end |
#tag(tag, attributes = {}) ⇒ Object
for single-line tags
10 11 12 |
# File 'lib/gsa/modules/xmlizer.rb', line 10 def tag(tag, attributes={}) "<#{tag.to_s}#{attributor(attributes)}/>\n" end |