157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
# File 'lib/leon.rb', line 157
def self.to_template(payload)
type = self.type_check(payload)
case type
when Constants::ARRAY
return [self.type_gcd(payload)]
when Constants::OBJECT
ret = Hash.new
payload.each { |k, v|
ret[k] = self.to_template(v)
}
return ret
when Constants::NATIVE_OBJECT
ret = Hash.new
payload.instance_variables.each { |k, v|
ret[k] = self.to_template(v)
}
when Constants::BOOLEAN + 1
return Constants::BOOLEAN
else
return type
end
end
|