diff options
author | lamont-granquist <lamont@scriptkiddie.org> | 2014-08-07 16:31:19 -0500 |
---|---|---|
committer | lamont-granquist <lamont@scriptkiddie.org> | 2014-08-07 16:31:19 -0500 |
commit | 1959569899868d5d7da83941072a0dce62a84f6c (patch) | |
tree | ba2daaf200b7e40845764976c01d5f2545aa847c | |
parent | 3d63d763184980f2423f11070c8b1b4001c2a495 (diff) | |
parent | 24922dbf881adf72ad828b24eb616c92ce96fb17 (diff) | |
download | ffi-yajl-1959569899868d5d7da83941072a0dce62a84f6c.tar.gz |
Merge pull request #3 from opscode/lcg/allow-comments-default
change allow_comment default to true
-rw-r--r-- | lib/ffi_yajl/parser.rb | 7 | ||||
-rw-r--r-- | spec/ffi_yajl/parser_spec.rb | 8 |
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/ffi_yajl/parser.rb b/lib/ffi_yajl/parser.rb index d095011..b6c8ce2 100644 --- a/lib/ffi_yajl/parser.rb +++ b/lib/ffi_yajl/parser.rb @@ -41,7 +41,12 @@ module FFI_Yajl raise ArgumentError, "options check_utf8 and dont_validate_strings are both true which conflict" end - yajl_opts[:yajl_allow_comments] = @opts[:allow_comments] + yajl_opts[:yajl_allow_comments] = true + + if @opts.key?(:allow_comments) + yajl_opts[:yajl_allow_comments] = @opts[:allow_comments] + end + yajl_opts[:yajl_dont_validate_strings] = (@opts[:check_utf8] == false || @opts[:dont_validate_strings]) yajl_opts[:yajl_allow_trailing_garbage] = @opts[:allow_trailing_garbage] yajl_opts[:yajl_allow_multiple_values] = @opts[:allow_multiple_values] diff --git a/spec/ffi_yajl/parser_spec.rb b/spec/ffi_yajl/parser_spec.rb index f896bf7..c6ca3e4 100644 --- a/spec/ffi_yajl/parser_spec.rb +++ b/spec/ffi_yajl/parser_spec.rb @@ -32,6 +32,14 @@ describe "FFI_Yajl::Parser" do expect(parser).to eq({"key"=>"value"}) end end + + context "by default" do + let(:options) { } + + it "should parse" do + expect(parser).to eq({"key"=>"value"}) + end + end end context "when json has multiline comments" do |