How do I access layer entities from Ruby?

How do I access layer entities from Ruby?

http://www.sketchup.com/intl/en/developer/docs/ourdoc/layers
http://www.sketchup.com/intl/en/developer/docs/ourdoc/layer

And I just posted a couple of examples here in the forum yesterday.

The first doesn’t use a model operation (so you can see how it litters the undo stack with each layer color change and attribute setting.) The second uses an operation to wrap it all up in one undoable operation.