Created
January 31, 2017 18:17
-
-
Save kjhenner/3dfd93627422ac742cfdea5c2be57bad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
def adjective | |
adjectives = ['huge', 'loser', 'incredible', 'classy', 'fantastic', 'great', 'illegal', 'low-energy', 'overrated', 'terrific', 'ugly', 'nasty', 'winning', 'stupid', 'weak', 'bad', 'dangerous'] | |
return adjectives.sample | |
end | |
def exaggerate(number) | |
number * (rand(1..3) + rand(1..3)) | |
end | |
def alternate(item) | |
case item | |
when String | |
if item.split.length > 1 | |
return alternate(item.split).join(' ') | |
elsif item =~ /^[0-9]+(\.[0-9]+)?$/ | |
return exaggerate(item.to_i).to_s | |
elsif item.split('.').length > 1 | |
return alternate(item.split('.')).join('.') | |
else | |
return [true, false].sample ? adjective + ' ' + item : item | |
end | |
when Numeric | |
return exaggerate(item) | |
when Array | |
return item.map{ |child| alternate(child) } | |
when Hash | |
return item.each{ |k,v| item[k] = alternate(v) } | |
end | |
end | |
alternate(JSON.parse(`facter #{ARGV[0]} -j`)).each{ |fact| puts fact.join " => " } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment