Module: Cogito
- Defined in:
- lib/cogito.rb,
lib/cogito/version.rb,
ext/cogito/cogito.c
Defined Under Namespace
Classes: CogitoError
Constant Summary collapse
- VERSION =
'0.2.0'.freeze
Class Method Summary collapse
Class Method Details
.to_iam(str) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'ext/cogito/cogito.c', line 37
static VALUE to_iam(VALUE self, VALUE str)
{
cg_buf_t *buffer;
char *input;
VALUE response;
if (TYPE(str) == T_NIL) return Qnil;
buffer = cg_buf_build();
input = rb_string_value_cstr(&str);
if (cg_to_iam(buffer, input) != 0) {
rb_raise(CogitoError, "IAM conversion failed");
}
response = rb_str_new2(buffer->content);
cg_buf_free(buffer);
return response;
}
|
.to_json(str, subs = {}) ⇒ Object
6 7 8 |
# File 'lib/cogito.rb', line 6 def to_json(str, subs = {}) convert_to_json(substitute(str, subs)) end |