From: why t. l. s. <yam...@wh...> - 2002-07-12 06:04:40
|
Okay, another great day of changes. - version: 0.18 date: 2002-07-11 changes: - "New YAML4R::add_domain_type, YAML4R::add_ruby_type, YAML4R::add_builtin_type! Beginning of an era!" - Transfer method prefixing. - Better support for commas, colons in unquoted strings. - All supported types now added with add_builtin_type. - Separators in scalars was throwing the parser off. - Seperated unit tests into smaller, more specific functions. - README and CHANGELOG now fully parsed by YAML4R. - The install.rb now has a --force option to force Racc to remake the grammar. The YAML4R::add_domain_type is ex-specially good stuff. Now types can be added by users. So for the following doc: --- #YAML:1.0 !whytheluckystiff.net/cheese type: nacho vendor: Tostitos consistency: chunky We're basically going to use the Hash to build our Cheese class: YAML4R::add_domain_type( "whytheluckystiff.net", /^cheese$/ ) { |type, val| # # Here type == 'cheese' # and val == { 'type' => 'nacho', 'vendor' => 'Tostitos', 'consistency' => 'Chunky' } # if val.type == Hash return Cheese.new( val ) else raise TypeError, "Cheese cannot be made of #{val.type}!" end } I'm still formulating a way for yaml4r to serialize Ruby objects without add_domain_type, but for apps that want to get their hooks into the serialization, I think the add_*_type methods truly shine and sparkle and glisten. _why ...and here's the latest spec compatibility list... compliance: - feature: YAML Separators supported?: | Custom YAML separators are allowed and will be used in exporting multiple documents. Multiple document parsing is not available as of this release. - feature: YAML directives supported?: > Directives are parsed correctly, but are of little use. The TAB directive is completely ignored, as tabs are not supported at this time. - feature: Transfer methods supported?: > Yes. !, !float, !int, !str, !ruby/regexp, and !ruby/struct. - feature: Private types supported?: No - feature: URI Escaping supported?: No - feature: URI Prefixing supported?: Yes - feature: Throwaway comments supported?: Yes - feature: Anchors supported?: Yes - feature: Aliases supported?: Yes - feature: Sequences supported?: Nested and flow both supported. - feature: Mappings supported?: Nested and flow both supported. - feature: Key indicators supported?: Yes - feature: Explicit indent supported?: Yes - feature: Chomping supported?: Yes - feature: Literal scalar supported?: Yes - feature: Folded scalar supported?: Yes - feature: Unquoted scalars supported?: Yes, but no support for spanning unquoted. - feature: Single-quoted scalars supported?: Yes - feature: Double-quoted scalars supported?: Yes - feature: Escape characters supported?: > Yes, most should be - feature: Strings supported?: > Yes, explicit and implict. - feature: Null supported?: > Yes, canonical and english. - feature: Boolean supported?: > Yes, canonical and english. - feature: Integer supported?: > Yes, canonical, oct, dec, and hex. - feature: Float supported?: > Yes, canonical, exp, fix, english - feature: Time supported?: > Yes, canonical, iso8601, spaced and ymd (as Date). - feature: Binary supported?: No. - feature: Default key supported?: No. - feature: Comment key supported?: No. |