Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[ANN] Net::DICT 0.9.0

1 view
Skip to first unread message

Nikolai Weibull

unread,
Nov 13, 2005, 5:11:12 PM11/13/05
to
(WARNING: This is a lazy-pants announcement. All I’ve done is
:r doc/README and added a couple of headings.)

Net::DICT README
================

Introduction
------------

Net::DICT is a library for Ruby that implements the client-side of the
Dictionary Server Protocol (DICT), described in
http://ietf.org/rfc/rfc2229.txt[RFC2229]. Documentation of the project
is provided in RDoc form, and can be generated by running the
`doc`-target of the Rakefile.

Authors
-------

Nikolai Weibull <nik...@bitwi.se>

News
----

0.9.0
~~~~~

Initial release.

Download
--------

A gem can (temporarily) be found at http://bitwi.se/net-dict-0.9.0.gem
You can also git the source at http://git.bitwi.se/

Examples
--------

A couple of examples follow.

Define a word:

require 'net/dict'

dict = Net::DICT.new('dict.org')
dict.client = 'Ruby-Net::DICT example'
puts dict.define('ruby', 'foldoc')[0]
dict.disconnect

Define a word using a pipeline (less traffic):

require 'net/dict'

dict = Net::DICT.new
definitions, _ = dict.pipeline do
dict.connect('dict.org')
dict.client = 'Ruby-Net::DICT pipeline example'
dict.define('ruby', 'foldoc')
dict.disconnect
end
puts definitions[0]

Get a list of databases on the server using a session (execute a
pipeline):

require 'net/dict'

dbs, _ = Net::DICT.session('Ruby-Net::DICT db example', 'dict.org') do |dict|
dict.databases
end
dbs.each{ |db, description| puts "#{db}: #{description}" }

Net::DICT also integrates with the URI and open-uri libraries:

require 'net/dict'
require 'uri/dict'
require 'open-uri'

open('dict://dict.org/d:word'){ |file| puts file.read }

A dict client using this library is being written, but nothing’s
stopping you from writing your own in the meantime ;-).

nikolai

--
Nikolai Weibull: now available free of charge at http://bitwi.se/!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}


0 new messages