Class: SistemKebut::XML::Builder
- Inherits:
-
Object
- Object
- SistemKebut::XML::Builder
show all
- Defined in:
- lib/xml/builder.rb
Instance Method Summary
collapse
Constructor Details
#initialize(r = nil) ⇒ Builder
Returns a new instance of Builder.
184
185
186
187
188
189
190
191
192
|
# File 'lib/xml/builder.rb', line 184
def initialize(r=nil)
@root = r
@kini = nil
if block_given?
yield(self)
else
raise BuilderBlock.new
end
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(nama, *args, &block) ⇒ Object
216
217
218
|
# File 'lib/xml/builder.rb', line 216
def method_missing(nama, *args, &block)
inner_devel(nama, *args, &block)
end
|
Instance Method Details
#build(tujuan = nil) ⇒ Object
207
208
209
210
211
212
213
214
|
# File 'lib/xml/builder.rb', line 207
def build(tujuan=nil)
hasil = inner_build.doc.root
w_acme(hasil) if hasil.name == "document"
return case tujuan
when :xml; hasil.to_xml
else; hasil.serialize(save_with: 0)
end
end
|
#catat_administrasi(id) ⇒ Object
203
204
205
|
# File 'lib/xml/builder.rb', line 203
def catat_administrasi(id)
return LapisAdministrasi.new(id, self)
end
|
#raw(elm) ⇒ Object
198
199
200
201
|
# File 'lib/xml/builder.rb', line 198
def raw(elm)
return nil unless elm.is_a?(Element)
@kini.append(elm)
end
|
#root_element ⇒ Object
194
195
196
|
# File 'lib/xml/builder.rb', line 194
def root_element
return @root
end
|