RubySymbol format_s = context.runtime.newSymbol("format");
for (int i = 0; i < params.getLength(); i++) {
IRubyObject param = params.entry(i);
Format valueFormat = Format.Text;
if (param.isNil()) {
values[i] = new Value(null, valueFormat);
} else if (param instanceof RubyHash) {
RubyHash hash = (RubyHash) params.get(i);
IRubyObject value = hash.op_aref(context, value_s);
IRubyObject type = hash.op_aref(context, type_s);
IRubyObject format = hash.op_aref(context, format_s);
if (!type.isNil())
oids[i] = (int) ((RubyFixnum) type).getLongValue();
if (!format.isNil())
valueFormat = ((RubyFixnum) format).getLongValue() == 1 ? Format.Binary : Format.Text;
if (value.isNil())
values[i] = new Value(null, valueFormat);
else
values[i] = new Value(((RubyString) value).getBytes(), valueFormat);
} else {
RubyString rubyString;
if (param instanceof RubyString)
rubyString = (RubyString) param;
else
rubyString = (RubyString) ((RubyObject) param).to_s();
values[i] = new Value(rubyString.getBytes(), valueFormat);
}
}
}