# FYI review: YAML improvements

**URL:** <https://www.ruby-forum.com/t/fyi-review-yaml-improvements/162809>\
**Category:** IronRuby\
**Created:** [March 13, 2009, 11:50pm UTC](https://www.ruby-forum.com/t/fyi-review-yaml-improvements/162809 "2009-03-13T23:50:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shri\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/898d66/32.png) [@Shri\_B](https://www.ruby-forum.com/u/Shri_B)\
**Post date:** [March 13, 2009, 11:50pm UTC](https://www.ruby-forum.com/t/fyi-review-yaml-improvements/162809/1 "2009-03-13T23:50:22Z")

</div>

> <https://github.com/shri-zz/ironruby/commit/a5d2d23b5c97546c478189d20b4d2c1b240e7159>
>
> Array.pack("a") was not dealing with nil input
> yaml.rb should to "require string…io" like MRI does
> Deleted a second copy of yaml.rb from the IronRuby.Libraries.Yaml folder
> Added MutableString.Dump property to be able to inspect large strings in VS.
> ir.exe -X:ExceptionDetail was not working in interactive mode because ir.exe catches the exception and does not call RubyExceptionData.SetCompiledTrace like a rescue block in Ruby code would do. Fixed this

Tomas has reviewed this.

Added support to YAML.quick\_emit to be called on nested objects where  
the  
same emitter needs to be flowed through  
Array.pack(“a”) was not dealing with nil input  
yaml.rb should to “require stringio” like MRI does  
Deleted a second copy of yaml.rb from the IronRuby.Libraries.Yaml folder  
Added MutableString.Dump property to be able to inspect large strings in  
VS.  
ir.exe -X:ExceptionDetail was not working in interactive mode because  
ir.exe catches the exception and does not call  
RubyExceptionData.SetCompiledTrace like a rescue block in Ruby code  
would  
do. Fixed this

Thanks,  
Shri

---

<div class="post-metadata">

**Author:** ![Shri\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/898d66/32.png) [@Shri\_B](https://www.ruby-forum.com/u/Shri_B)\
**Post date:** [March 14, 2009, 7:10am UTC](https://www.ruby-forum.com/t/fyi-review-yaml-improvements/162809/2 "2009-03-14T07:10:34Z")

</div>

This is a review on both this and the Gzip commit:

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubyspec\fixtures\class.rb

o Please use parenthesis for declaring methods for consistency

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubyspec\library\yaml\each\_node\_spec.rb

o Please use += instead of i = i + 1

o Have we checked that not being a subclass of YAML::Syck::Map is ok?  
I suspect it is an implementation detail, but I want to check. If it is  
implementation detail, then we probably don’t need to spec that one.

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubyspec\library\yaml\emitter\_spec.rb

o Don’t spec method lists. For one, a implementation may choose a  
superset (so == is wrong), for two, RubySpec doesn’t spec method lists.

o Same question about the subclass, which makes me wonder if that 1st  
spec is needed.

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubyspec\library\yaml\quick\_emit\_spec.rb

o Subclass spec

o Don’t spec exception messages, only exception types.

o I would add a ScratchPad.clear to a before(:each)

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubyspec\library\yaml\to\_yaml\_spec.rb

o Don’t spec method lists.

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubyspec\library\yaml\fixtures\common.rb

o Get rid of EmitterMethods and OutMethods

o Line 54 and 68, no need to do != nil. If the object is nil it will  
be false. Also, get rid of the "then"s

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubyspec\library\gzipreader\wrap\_spec.rb

o You’re using ScratchPad when there is no reason. 22, 29, put your  
should in the Zlib blocks.

o 38 is fine

o 56: don’t spec the exception message

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubyspec\library\zlib\gzipwriter\flush\_spec.rb

o Don’t spec error messages

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubysync\library\zlib\gzipwriter\wrap\_spec.rb

o 28: should in the block

o 34

1. 

```
  Zlib::GzipWriter.wrap(@io) do |gz|

```

From: Shri B.  
Sent: Friday, March 13, 2009 3:41 PM  
To: IronRuby External Code R.  
Cc: removed\_email\_address@domain.invalid  
Subject: FYI review: YAML improvements

> <https://github.com/shri-zz/ironruby/commit/a5d2d23b5c97546c478189d20b4d2c1b240e7159>
>
> Array.pack("a") was not dealing with nil input
> yaml.rb should to "require string…io" like MRI does
> Deleted a second copy of yaml.rb from the IronRuby.Libraries.Yaml folder
> Added MutableString.Dump property to be able to inspect large strings in VS.
> ir.exe -X:ExceptionDetail was not working in interactive mode because ir.exe catches the exception and does not call RubyExceptionData.SetCompiledTrace like a rescue block in Ruby code would do. Fixed this

Tomas has reviewed this.

Added support to YAML.quick\_emit to be called on nested objects where  
the  
same emitter needs to be flowed through  
Array.pack(“a”) was not dealing with nil input  
yaml.rb should to “require stringio” like MRI does  
Deleted a second copy of yaml.rb from the IronRuby.Libraries.Yaml folder  
Added MutableString.Dump property to be able to inspect large strings in  
VS.  
ir.exe -X:ExceptionDetail was not working in interactive mode because  
ir.exe catches the exception and does not call  
RubyExceptionData.SetCompiledTrace like a rescue block in Ruby code  
would  
do. Fixed this

Thanks,  
Shri

---

<div class="post-metadata">

**Author:** ![Shri\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/898d66/32.png) [@Shri\_B](https://www.ruby-forum.com/u/Shri_B)\
**Post date:** [March 16, 2009, 7:44am UTC](https://www.ruby-forum.com/t/fyi-review-yaml-improvements/162809/3 "2009-03-16T07:44:56Z")

</div>

FYI: After talking with Brian from RubySpec, I have pulled the specs  
that check for be\_kind\_of(YAML::Syck::\*). We have decided that it is  
implementation detail, and since IronRuby and RbYaml don’t support it,  
it isn’t something that should be specced.

JD

From: Jim D.  
Sent: Friday, March 13, 2009 11:13 PM  
To: Jim D.; Shri B.; IronRuby External Code R.  
Cc: removed\_email\_address@domain.invalid  
Subject: RE: FYI review: YAML improvements

Hit ctl-enter instead of shift-enter:

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubysync\library\zlib\gzipwriter\wrap\_spec.rb

o 28: should in the block

o 34

1. Zlib::GzipWriter.wrap(@io) do |gz|  
:end\_of\_block  
end.should == :end\_of\_block

o 64: error messages  
JD

From: Jim D.  
Sent: Friday, March 13, 2009 11:10 PM  
To: Shri B.; IronRuby External Code R.  
Cc: removed\_email\_address@domain.invalid  
Subject: RE: FYI review: YAML improvements

This is a review on both this and the Gzip commit:

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubyspec\fixtures\class.rb

o Please use parenthesis for declaring methods for consistency

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubyspec\library\yaml\each\_node\_spec.rb

o Please use += instead of i = i + 1

o Have we checked that not being a subclass of YAML::Syck::Map is ok?  
I suspect it is an implementation detail, but I want to check. If it is  
implementation detail, then we probably don’t need to spec that one.

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubyspec\library\yaml\emitter\_spec.rb

o Don’t spec method lists. For one, a implementation may choose a  
superset (so == is wrong), for two, RubySpec doesn’t spec method lists.

o Same question about the subclass, which makes me wonder if that 1st  
spec is needed.

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubyspec\library\yaml\quick\_emit\_spec.rb

o Subclass spec

o Don’t spec exception messages, only exception types.

o I would add a ScratchPad.clear to a before(:each)

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubyspec\library\yaml\to\_yaml\_spec.rb

o Don’t spec method lists.

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubyspec\library\yaml\fixtures\common.rb

o Get rid of EmitterMethods and OutMethods

o Line 54 and 68, no need to do != nil. If the object is nil it will  
be false. Also, get rid of the "then"s

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubyspec\library\gzipreader\wrap\_spec.rb

o You’re using ScratchPad when there is no reason. 22, 29, put your  
should in the Zlib blocks.

o 38 is fine

o 56: don’t spec the exception message

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubyspec\library\zlib\gzipwriter\flush\_spec.rb

o Don’t spec error messages

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubysync\library\zlib\gzipwriter\wrap\_spec.rb

o 28: should in the block

o 34

1. Zlib::GzipWriter.wrap(@io) do |gz|  
From: Shri B.  
Sent: Friday, March 13, 2009 3:41 PM  
To: IronRuby External Code R.  
Cc: removed\_email\_address@domain.invalid  
Subject: FYI review: YAML improvements

> <https://github.com/shri-zz/ironruby/commit/a5d2d23b5c97546c478189d20b4d2c1b240e7159>
>
> Array.pack("a") was not dealing with nil input
> yaml.rb should to "require string…io" like MRI does
> Deleted a second copy of yaml.rb from the IronRuby.Libraries.Yaml folder
> Added MutableString.Dump property to be able to inspect large strings in VS.
> ir.exe -X:ExceptionDetail was not working in interactive mode because ir.exe catches the exception and does not call RubyExceptionData.SetCompiledTrace like a rescue block in Ruby code would do. Fixed this

Tomas has reviewed this.

Added support to YAML.quick\_emit to be called on nested objects where  
the  
same emitter needs to be flowed through  
Array.pack(“a”) was not dealing with nil input  
yaml.rb should to “require stringio” like MRI does  
Deleted a second copy of yaml.rb from the IronRuby.Libraries.Yaml folder  
Added MutableString.Dump property to be able to inspect large strings in  
VS.  
ir.exe -X:ExceptionDetail was not working in interactive mode because  
ir.exe catches the exception and does not call  
RubyExceptionData.SetCompiledTrace like a rescue block in Ruby code  
would  
do. Fixed this

Thanks,  
Shri

---

<div class="post-metadata">

**Author:** ![Shri\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/898d66/32.png) [@Shri\_B](https://www.ruby-forum.com/u/Shri_B)\
**Post date:** [March 14, 2009, 7:42am UTC](https://www.ruby-forum.com/t/fyi-review-yaml-improvements/162809/4 "2009-03-14T07:42:41Z")

</div>

Hit ctl-enter instead of shift-enter:

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubysync\library\zlib\gzipwriter\wrap\_spec.rb

o 28: should in the block

o 34

1. 

```
  Zlib::GzipWriter.wrap(@io) do |gz|

```

:end\_of\_block  
end.should == :end\_of\_block

o 64: error messages  
JD

From: Jim D.  
Sent: Friday, March 13, 2009 11:10 PM  
To: Shri B.; IronRuby External Code R.  
Cc: removed\_email\_address@domain.invalid  
Subject: RE: FYI review: YAML improvements

This is a review on both this and the Gzip commit:

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubyspec\fixtures\class.rb

o Please use parenthesis for declaring methods for consistency

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubyspec\library\yaml\each\_node\_spec.rb

o Please use += instead of i = i + 1

o Have we checked that not being a subclass of YAML::Syck::Map is ok?  
I suspect it is an implementation detail, but I want to check. If it is  
implementation detail, then we probably don’t need to spec that one.

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubyspec\library\yaml\emitter\_spec.rb

o Don’t spec method lists. For one, a implementation may choose a  
superset (so == is wrong), for two, RubySpec doesn’t spec method lists.

o Same question about the subclass, which makes me wonder if that 1st  
spec is needed.

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubyspec\library\yaml\quick\_emit\_spec.rb

o Subclass spec

o Don’t spec exception messages, only exception types.

o I would add a ScratchPad.clear to a before(:each)

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubyspec\library\yaml\to\_yaml\_spec.rb

o Don’t spec method lists.

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubyspec\library\yaml\fixtures\common.rb

o Get rid of EmitterMethods and OutMethods

o Line 54 and 68, no need to do != nil. If the object is nil it will  
be false. Also, get rid of the "then"s

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubyspec\library\gzipreader\wrap\_spec.rb

o You’re using ScratchPad when there is no reason. 22, 29, put your  
should in the Zlib blocks.

o 38 is fine

o 56: don’t spec the exception message

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubyspec\library\zlib\gzipwriter\flush\_spec.rb

o Don’t spec error messages

- 

C:\vsl\rubysync\Merlin\External\Languages\IronRuby\mspec\rubysync\library\zlib\gzipwriter\wrap\_spec.rb

o 28: should in the block

o 34

1. 

```
  Zlib::GzipWriter.wrap(@io) do |gz|

```

From: Shri B.  
Sent: Friday, March 13, 2009 3:41 PM  
To: IronRuby External Code R.  
Cc: removed\_email\_address@domain.invalid  
Subject: FYI review: YAML improvements

> <https://github.com/shri-zz/ironruby/commit/a5d2d23b5c97546c478189d20b4d2c1b240e7159>
>
> Array.pack("a") was not dealing with nil input
> yaml.rb should to "require string…io" like MRI does
> Deleted a second copy of yaml.rb from the IronRuby.Libraries.Yaml folder
> Added MutableString.Dump property to be able to inspect large strings in VS.
> ir.exe -X:ExceptionDetail was not working in interactive mode because ir.exe catches the exception and does not call RubyExceptionData.SetCompiledTrace like a rescue block in Ruby code would do. Fixed this

Tomas has reviewed this.

Added support to YAML.quick\_emit to be called on nested objects where  
the  
same emitter needs to be flowed through  
Array.pack(“a”) was not dealing with nil input  
yaml.rb should to “require stringio” like MRI does  
Deleted a second copy of yaml.rb from the IronRuby.Libraries.Yaml folder  
Added MutableString.Dump property to be able to inspect large strings in  
VS.  
ir.exe -X:ExceptionDetail was not working in interactive mode because  
ir.exe catches the exception and does not call  
RubyExceptionData.SetCompiledTrace like a rescue block in Ruby code  
would  
do. Fixed this

Thanks,  
Shri
