Advertisement
Guest User

Untitled

a guest
Aug 28th, 2013
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # intentionally obfuscated copy pasta
  2. module AddictingIdioms
  3.   def inject_overdose
  4.    object = { :type => "api_object[table]", :properties => ['p1', 'p2'] }
  5.     properties = call_api_thing(object, nil).results.map { |x| x.properties }
  6.     config = properties.inject([]) do |result,property|
  7.       result << {
  8.         property.first.name => property.first.value,
  9.         property.last.name => property.last.value
  10.       }
  11.     end
  12.     return config.map { |c| c["p2"] }.uniq.inject([]) do |result,p|
  13.       result << {
  14.         food: p,
  15.         poop: case p
  16.         when /abc/, /xyz/
  17.           "Hello"
  18.         when /BoobHammer/
  19.           "Bye"
  20.         end,
  21.         boob: config.select { |x| x["p2"] == p }.map { |x| x['p1'] }
  22.       }
  23.     end
  24.   end
  25. end
  26.  
  27. configs = AddictingIdioms.inject_overdose([]) { |result,config| result << CONFIG.merge(config) }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement