README.rdoc in SgfParser-0.8.0 vs README.rdoc in SgfParser-0.9.0

- old
+ new

@@ -1,25 +1,35 @@ +=INFORMATION +Author: Aldric Giacomoni + +Email : aldric~at~trevoke.net (feedback very welcome!) + SGF: all formats (but untested with FF < 4) -Ruby: >1.8.7 (may work with 1.8.6) +Ruby: >=1.8.7 (may work with 1.8.6) + +=QUICK HOWTO Example: -require 'sgf_parser' -tree = SgfParser::Tree.new :filename => File -tree = SgfParser::Tree.new :sgf_string => String + require 'sgf_parser' + tree = SgfParser::Tree.new :filename => File + tree = SgfParser::Tree.new :string => String All trees begin with an empty node ( @root) which allows a simple support of multiple gametrees. + Most games will just care about, say, -tree.root.children[0] which is the first node of the first gametree. + tree.root.children[0] which is the first node of the first gametree. For any node, one can summon the properties as such: -node.properties # => returns a hash of the properties. + node.properties # => returns a hash of the properties. A single property can be called, like the comments, for instance, like so: -node.C # => returns the comments for this node. + node.C # => returns the comments for this node. The library currently uses method_missing to painlessly return the data. I must admit that this is both clever coding and laziness on my part. -The 'SGF Indenter', the purpose of which is to make the actual SGF file more -human readable, is working. +There is also a SGF Indenter. Its purpose is to make SGF files more readable to humans at a glance. + require 'sgf_parser/sgfindent' # Done automatically if you require 'sgf_parser' + sgf = SgfParser::Indenter.new 'some_ugly_file.sgf' # Will output to the console + sgf = SgfParser::Indenter.new 'some_ugly_file.sgf' 'pretty.sgf' # Sends the result to a new file. ___ TODO ? Create a "Game" class, and if a whole set of () exists, then I have a game?