Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.