Skip to content

Instantly share code, notes, and snippets.

@ellismarte
Last active June 9, 2016 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ellismarte/bea2e991f292cf3c9a8710860f2c8a08 to your computer and use it in GitHub Desktop.
Save ellismarte/bea2e991f292cf3c9a8710860f2c8a08 to your computer and use it in GitHub Desktop.
require 'mojo_logger'
def action(arg)
new_data = []
begin
arg["data"].each do |x|
begin
new_data << x + 1
rescue StandardError => e
puts "mmm bad data dude "
puts "#{arg} #{e}"
end
end
# raise NoMethodError
rescue StandardError => e
puts "looks like you aint got no data bro"
puts "#{arg} #{e}"
end
new_data
end
p action({"data" => [1,2,3,4,5,6,7,8,9,0]})
p action({"data" => ["1","2","3","4","5","6","7","8","9","0"]})
p action({"daat" => [1,2,3,4,5,6,7,8,9,0]})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment