summaryrefslogtreecommitdiff
path: root/jq.pyx
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2013-06-22 10:08:12 +0100
committerMichael Williamson <mike@zwobble.org>2013-06-22 10:08:12 +0100
commitc15d112e79f5ea5dc81cce720589c6073be1ce41 (patch)
tree71228ca385457fdaaaf9aba054f911af3bbc5f6f /jq.pyx
parenta258b2f7f3425e4d056ac55c6211f15faa98452d (diff)
Combine transform_{string,json} into a single transform method
Diffstat (limited to 'jq.pyx')
-rw-r--r--jq.pyx8
1 files changed, 3 insertions, 5 deletions
diff --git a/jq.pyx b/jq.pyx
index c917565..f94aab2 100644
--- a/jq.pyx
+++ b/jq.pyx
@@ -53,13 +53,11 @@ cdef class _Program(object):
def __dealloc__(self):
jq_teardown(&self._jq)
- def transform_string(self, char* input):
- result_strings = self._string_to_strings(input)
+ def transform(self, char* input, raw=False):
+ raw_input = input if raw else json.dumps(input)
+ result_strings = self._string_to_strings(raw_input)
return _Result(result_strings)
- def transform_json(self, object input):
- return self.transform_string(json.dumps(input))
-
cdef object _string_to_strings(self, char* input):
cdef jv_parser parser