Skip to content

Instantly share code, notes, and snippets.

View Manfred's full-sized avatar

Manfred Stienstra Manfred

  • Fingertips
  • H4sIAFn6cmUAA0WMMQ7CMBAEe14RTJM0prdDEdFAh8ID0Mm5SCcs25wvIIH4O06QoNhmd3YYbxMxKnBCMVxcDMLRe+QtA3khVNZ5yLna739T2y3wvzCmOx3tgGPlLGMYkOvkgYKp1IFUY0u1BHZfV9f2RZ7LLSVPDmabzejHmdIUSAg8PXFtQXOcBLMeGB4vjlFqiUXrNk41b9uDuxpzRr4j6yzAUkNKBprVB8hGiinYAAAA
View GitHub Profile
@Manfred
Manfred / gist:942173
Created April 26, 2011 12:31 — forked from alloy/gist:942157
Square job interview exercise
class Payment < Struct.new(:amount)
def self.fees
if @fees.nil?
@fees = {}; ObjectSpace.each_object do |object|
if object.class == String and match = /returns.*of\s\$(\d+).*\(\$([\d\.]+)\)/.match(object.to_s)
@fees[match[1].to_i] = match[2].to_f
end
end
end; @fees
end