Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #28 from tanelj/master

Fixed issue where it was impossible to turn off JSON callback wrapping
  • Loading branch information...
commit bf764da9dcfa48c8d0a62111fd2b7060d6491e17 2 parents 93c314c + 559f8ca
Garrett Bjerkhoel dewski authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/json_builder/compiler.rb
6 lib/json_builder/compiler.rb
View
@@ -44,9 +44,9 @@ def generate(*args, &block)
# Returns instance of JSONBuilder::Compiler.
def initialize(options={})
@_members = []
- @_scope = options[:scope]
- @_callback = options[:callback] || true
- @_pretty_print = options[:pretty] || false
+ @_scope = options.fetch(:scope, nil)
+ @_callback = options.fetch(:callback, true)
+ @_pretty_print = options.fetch(:pretty, false)
# Only copy instance variables if there is a scope and presence of Rails
copy_instance_variables_from(@_scope) if @_scope
Please sign in to comment.
Something went wrong with that request. Please try again.