Module: Hammurabi
- Extended by:
- Hammurabi
- Included in:
- Hammurabi
- Defined in:
- lib/hammurabi.rb,
lib/hammurabi/version.rb
Overview
HAMMURABI CODE Translated by L.W. King (1910) Edited by Richard Hooker ©1996, Richard Hooker
For information contact: Richard Hines Updated 6-6-1999
Constant Summary collapse
- CODE =
File.read(File.('../hammurabi/code.txt', __FILE__)).scan(/(\n\d+\n.+?\n)/)
- VERSION =
'1.0'
Instance Method Summary collapse
Instance Method Details
#find(words) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# 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 |