Skip to content

Instantly share code, notes, and snippets.

Alessandro Gurgel alessandrogurgel

Block or report user

Report or block alessandrogurgel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View flatten.rb
def flatten_array(a)
result = []
a.each do |e|
flatten_array_deep(e).each do |i|
result << i
end
end
result
end
@alessandrogurgel
alessandrogurgel / json_utilities.rb
Created Nov 18, 2015 — forked from binarydev/json_utilities.rb
Ruby - JSON Equality Check
View json_utilities.rb
module JsonUtilities
# compares two json objects (Array, Hash, or String to be parsed) for equality
def compare_json(json1, json2)
# return false if classes mismatch or don't match our allowed types
unless((json1.class == json2.class) && (json1.is_a?(String) || json1.is_a?(Hash) || json1.is_a?(Array)))
return false
end
# initializing result var in the desired scope
You can’t perform that action at this time.