Skip to content

Commit

Permalink
keep consistence of name style
Browse files Browse the repository at this point in the history
  • Loading branch information
YukangChen committed Jan 14, 2016
1 parent 6f8380a commit d413fc1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/resources/org/yinwang/rubysonar/ruby/dump_ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -882,11 +882,11 @@ def negate(exp)

end

def hash_nest_max hash
def hash_max_nest(hash)
if hash.is_a?(Array)
hash.map{ |e| (hash_nest_max e).to_i }.max.to_i + 1
hash.map{ |e| hash_max_nest(e).to_i }.max.to_i + 1
elsif hash.is_a?(Hash)
hash.values.map{ |s| (hash_nest_max s).to_i }.max.to_i + 1
hash.values.map{ |s| hash_max_nest(s).to_i }.max.to_i + 1
else
0
end
Expand All @@ -896,7 +896,7 @@ def parse_dump(input, output, endmark)
begin
simplifier = AstSimplifier.new(input)
hash = simplifier.simplify
json_string = JSON.pretty_generate(hash, max_nesting: (hash_nest_max hash))
json_string = JSON.pretty_generate(hash, max_nesting: hash_max_nest(hash))
out = File.open(output, 'wb')
out.write(json_string)
out.close
Expand Down

0 comments on commit d413fc1

Please sign in to comment.