module Hammurabi
HAMMURABI CODE
Translated by L.W. King (1910) Edited by Richard Hooker ©1996, Richard Hooker
For information contact: Richard Hines Updated 6-6-1999
Constants
- CODE
- VERSION
Public Instance Methods
find(words)
click to toggle source
# File lib/hammurabi.rb, line 19 def find words words = words.scan(/\w+/i).flatten # $stdout.puts words.inspect CODE.find do |law| # $stdout.puts law[0..3].strip words.all? { |word| law =~ /\b#{word}\b/ } end end
law!()
click to toggle source
# File lib/hammurabi.rb, line 15 def law! CODE[rand(CODE.size)] end