Sha256: 6b48608f665969484388a41036e1aca432ca51ec50e83ec56fcc6ab6ebdcf88e

Contents?: true

Size: 622 Bytes

Versions: 3

Compression:

Stored size: 622 Bytes

Contents

#!/usr/bin/ruby

BEGIN {
	$LOAD_PATH.unshift File::dirname(File::dirname( __FILE__ )) + "/lib"
	require 'linguistics'
}

Linguistics::use( :en )

# Just a fun little demo of the conjunction (junction, what's your) function.

MinObjects = 5
MaxObjects = 35
Objects = %w[
	butcher baker candlestick-maker
	mouse clock
	cat fiddle cow moon dog sport dish spoon
	tisket tasket
	jack jill hill pail crown
]

def randobjlist
	objs = []
	0.upto( rand(MaxObjects - MinObjects) + MinObjects ) do
		objs << Objects[ rand(Objects.nitems) - 1 ]
	end

	return objs
end


puts "Random object list:\n\t" +
	randobjlist().en.conjunction

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
eviltrout-linguistics-1.0.6.1 experiments/randobjlist.rb
Linguistics-1.0.3 experiments/randobjlist.rb
Linguistics-1.0.5 experiments/randobjlist.rb