I hereby claim:
- I am calamitous on github.
- I am calamitous (https://keybase.io/calamitous) on keybase.
- I have a public key ASA43YhXQS0z9LamN5xxA_lnEUv25VNJP30eETBiKhstGgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/env ruby | |
gem 'minitest' | |
require 'minitest/autorun' | |
class Array | |
# Provide a method to remove all nesting from arbitrarily nested arrays | |
def flattener | |
# For each element in the array, either: | |
self.reduce([]) do |accumulator, element| | |
if element.is_a?(Array) |
The first entry is an implementation of the Luhn algorithm, a checksum commonly | |
used to validate credit card numbers: | |
https://github.com/Calamitous/Luhn-algorithm | |
The operation is straightforward; initialize the Luhn class with a number, and | |
the `valid?` instance method will return a true or a false if the checksum | |
checks out. | |
This was a small exercise to exhibit Ruby's object orientation, testability, and |