Skip to content

Instantly share code, notes, and snippets.

@moskyb
Last active December 4, 2015 01:58
Show Gist options
  • Save moskyb/2cd6c330db5171d5f83e to your computer and use it in GitHub Desktop.
Save moskyb/2cd6c330db5171d5f83e to your computer and use it in GitHub Desktop.
def mystery(mech, invoice_rel)
page = mech.get("https://something.flickelectric.co.nz/" + invoice_rel)
foo = page.search('dl[id="invoice_details"]').to_s.include?("actual")
bar = page.search('tfoot[class~="invoice-totals"]').children
baz = bar.text.gsub(/\s+/, "")
dollar = -1
while baz[dollar] != '$'
dollar -= 1
end
bing = (totals [dollar + 1..-1].to_f != 0.00) && foo
return bing
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment