Class: XMLService::I_DS
Overview
data structure collection
Instance Method Summary
collapse
Methods inherited from I_BaseMulti
#[], #add, #assoc, #bin, #char, #count, #dec, #double, #elemParse, #float4, #float8, #getIndexValue, #initialize, #initialize_value, #input_elems, #long, #longlong, #real, #short, #struct, #tiny, #ulong, #ulonglong, #ushort, #utiny, #value, #var, #varchar, #varchar4, #zone
Methods inherited from I_Meta
#add_user_accessor, #instance_variable_forward_get, #instance_variable_forward_set, #parse_diag_attr, #parse_output_attr, #parse_return_attr, #remove_user_accessor, #shortCut
Instance Method Details
#initialize_doc(element) ⇒ Object
1106
1107
1108
1109
1110
|
# File 'lib/xmlservice.rb', line 1106
def initialize_doc(element)
@xml_dim = element.attributes['dim']
@xml_dou = element.attributes['dou']
super(element)
end
|
#initialize_type2(var, dim) ⇒ Object
1112
1113
1114
1115
1116
1117
1118
1119
|
# File 'lib/xmlservice.rb', line 1112
def initialize_type2(var,dim)
@xml_dim = 1
if dim > 1
@xml_dim = dim
end
@xml_dou = nil
self.initialize_value(var,Array.new)
end
|
#initialize_type3(var, dim, elem) ⇒ Object
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
|
# File 'lib/xmlservice.rb', line 1120
def initialize_type3(var,dim,elem)
@xml_dim = 1
if dim > 1
@xml_dim = dim
end
if elem.instance_of? String
@xml_dou = elem
self.initialize_value(var,Array.new)
else
@xml_dou = nil
self.initialize_value(var,elem)
end
end
|
#initialize_type4(var, dim, dou, elem) ⇒ Object
1135
1136
1137
1138
1139
1140
1141
1142
|
# File 'lib/xmlservice.rb', line 1135
def initialize_type4(var,dim,dou,elem)
@xml_dim = 1
if dim > 1
@xml_dim = dim
end
@xml_dou = dou
self.initialize_value(var,elem)
end
|
#initialize_zero ⇒ Object
1101
1102
1103
1104
1105
|
# File 'lib/xmlservice.rb', line 1101
def initialize_zero
@xml_var = 'ds'
@xml_elem = nil
self.initialize_value(var,elem)
end
|
#to_xml ⇒ Object
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
|
# File 'lib/xmlservice.rb', line 1164
def to_xml
dim = " dim='#{@xml_dim}'"
dou = ""
if @xml_dou
dou = " dou='#{@xml_dou}'"
end
xml = "<ds var='#{@xml_var}'#{dim}#{dou}>\n"
xml << self.to_xml_recursive(@xml_elem)
xml << "</ds>\n"
xml
end
|
#to_xml_recursive(elem) ⇒ Object
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
|
# File 'lib/xmlservice.rb', line 1143
def to_xml_recursive(elem)
xml = ""
if elem.instance_of? Hash
elem.each do |k,a|
if a.instance_of? Hash or a.instance_of? Array
xml << self.to_xml_recursive(a)
else
xml << a.to_xml
end
end
elsif elem.instance_of? Array
elem.each do |a|
if a.instance_of? Hash or a.instance_of? Array
xml << self.to_xml_recursive(a)
else
xml << a.to_xml
end
end
end
xml
end
|