Class: ApiBuilder::StringWithName
- Inherits:
-
String
- Object
- String
- ApiBuilder::StringWithName
- Defined in:
- lib/api_builder/with_name.rb
Instance Method Summary collapse
-
#initialize(name, value) ⇒ StringWithName
constructor
A new instance of StringWithName.
- #to_xml(options = {}) ⇒ Object
Constructor Details
#initialize(name, value) ⇒ StringWithName
Returns a new instance of StringWithName.
31 32 33 34 |
# File 'lib/api_builder/with_name.rb', line 31 def initialize(name, value) @name = name super value.to_s end |
Instance Method Details
#to_xml(options = {}) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/api_builder/with_name.rb', line 36 def to_xml( = {}) if [:builder] xml = [:builder] else xml = Builder::XmlMarkup.new xml.instruct! end xml.tag! name, to_s end |