Skip to content

Commit

Permalink
fix shallow_json for frozen_string_literal (#1605)
Browse files Browse the repository at this point in the history
  • Loading branch information
causztic authored and vbrazo committed May 10, 2019
1 parent cc9f09e commit 76f8c76
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/faker/default/json.rb
Expand Up @@ -4,16 +4,16 @@ class Json < Base

class << self
def shallow_json(width = 3, options = { key: 'Name.first_name', value: 'Name.first_name' })
options[:key] = options[:key].prepend('Faker::')
options[:value] = options[:value].prepend('Faker::')
options[:key] = 'Faker::' + options[:key]
options[:value] = 'Faker::' + options[:value]

hash = build_shallow_hash(width, options)
JSON.generate(hash)
end

def add_depth_to_json(json = shallow_json, width = 3, options = { key: 'Name.first_name', value: 'Name.first_name' })
options[:key] = options[:key].prepend('Faker::')
options[:value] = options[:value].prepend('Faker::')
options[:key] = 'Faker::' + options[:key]
options[:value] = 'Faker::' + options[:value]

hash = JSON.parse(json)
hash.each do |key, _|
Expand Down

0 comments on commit 76f8c76

Please sign in to comment.