README.rdoc in SgfParser-0.9.1 vs README.rdoc in SgfParser-1.0.0

- old
+ new

@@ -1,38 +1,44 @@ -=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) - -=QUICK HOWTO -Example: - 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. - -For any node, one can summon the properties as such: - 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. - -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. - -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? -That way maybe I can easily go to multiple games stored in a single SGF file? -Mostly syntactic sugar, but may be worth implementing. +=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) + +=QUICK HOWTO +Example: + require 'sgf' + tree = SGF::Parser.new file_or_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. + +For any node, one can summon the properties as such: + 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.comments # => syntactic sugar + +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. + +There is also a SGF Indenter. Its purpose is to make SGF files more readable to humans at a glance. + require 'sgf/sgfindent' # Done automatically if you require 'sgf_parser' + sgf = SGF::Indenter.new 'some_ugly_file.sgf' # Will output to the console + sgf = SGF::Indenter.new 'some_ugly_file.sgf' 'pretty.sgf' # Sends the result to a new file. + +___ + +TODO +- Create a "Game" class that wraps a complete set of () for ease of use +- implement node.next to go to node.children[0] because who wants to type that anyway? +- implement a 'current' node in Tree so we don't have to jump from node to node. This means.. + - implement tree.next instead of node.next for tree.current_node.children[0] +- examine/fix the smell that when you use add_children, it also sets the parent on the passed-in nodes. +- fix the multiple properties bug in the SGF indenter as well +- see how much of the parser code the indenter can use, since it's basically the same logic +