Module: Jsonnet
- Defined in:
- lib/jsonnet.rb,
lib/jsonnet/vm.rb,
lib/jsonnet/version.rb,
ext/jsonnet/jsonnet.c
Defined Under Namespace
Classes: EvaluationError, FormatError, UnsupportedEncodingError, VM
Constant Summary collapse
- VERSION =
"0.5.3"
- STRING_STYLE_DOUBLE =
rb_str_new_cstr("d")
- STRING_STYLE_SINGLE =
rb_str_new_cstr("s")
- STRING_STYLE_LEAVE =
rb_str_new_cstr("l")
- COMMENT_STYLE_HASH =
rb_str_new_cstr("h")
- COMMENT_STYLE_SLASH =
rb_str_new_cstr("s")
- COMMENT_STYLE_LEAVE =
rb_str_new_cstr("l")
Class Method Summary collapse
-
.evaluate(jsonnet, jsonnet_options: {}, json_options: {}) ⇒ Hash
Evaluates a string of Jsonnet and returns a hash of the resulting JSON.
-
.version ⇒ String
Returns the version of the underlying C++ implementation of Jsonnet.
-
.load(path, jsonnet_options: {}, json_options: {}) ⇒ Hash
Loads a Jsonnet file and returns a hash of the resulting JSON.
Class Method Details
.evaluate(jsonnet, jsonnet_options: {}, json_options: {}) ⇒ Hash
Note:
This method runs Jsonnet::VM#evaluate and runs the string output through JSON.parse so those should be looked at for furhter details
Evaluates a string of Jsonnet and returns a hash of the resulting JSON
23 24 25 26 |
# File 'lib/jsonnet.rb', line 23 def evaluate(jsonnet, jsonnet_options: {}, json_options: {}) output = VM.evaluate(jsonnet, ) JSON.parse(output, ) end |
.version ⇒ String
Returns the version of the underlying C++ implementation of Jsonnet.
13 14 15 16 17 |
# File 'ext/jsonnet/jsonnet.c', line 13
static VALUE
jw_s_version(VALUE mod)
{
return rb_usascii_str_new_cstr(jsonnet_version());
}
|
.load(path, jsonnet_options: {}, json_options: {}) ⇒ Hash
Note:
This method runs Jsonnet::VM#evaluate_file and runs the string output through JSON.parse so those should be looked at for furhter details
Loads a Jsonnet file and returns a hash of the resulting JSON
43 44 45 46 |
# File 'lib/jsonnet.rb', line 43 def load(path, jsonnet_options: {}, json_options: {}) output = VM.evaluate_file(path, ) JSON.parse(output, ) end |