# rAtom and Atom::Generation

**URL:** <https://www.ruby-forum.com/t/ratom-and-atom-generation/162928>\
**Category:** Ruby\
**Created:** [March 15, 2009, 9:45pm UTC](https://www.ruby-forum.com/t/ratom-and-atom-generation/162928 "2009-03-15T21:45:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sutch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/13edae/32.png) [@sutch](https://www.ruby-forum.com/u/sutch)\
**Post date:** [March 15, 2009, 9:45pm UTC](https://www.ruby-forum.com/t/ratom-and-atom-generation/162928/1 "2009-03-15T21:45:42Z")

</div>

I’m attempting to produce an atom feed using rAtom and have run into  
one issue with Atom::Generator. The docs are not real clear. I have  
created a new generator using:

feed.generator = Atom::Generator.new({:version =\> “0.1”})

This produces:

There does not seem to be a method for setting the contents of the  
generator. What I want output is something along the lines of:

My Generator

Anyone know how this might be accomplished?

---

<div class="post-metadata">

**Author:** ![sutch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/13edae/32.png) [@sutch](https://www.ruby-forum.com/u/sutch)\
**Post date:** [March 15, 2009, 9:46pm UTC](https://www.ruby-forum.com/t/ratom-and-atom-generation/162928/2 "2009-03-15T21:46:52Z")

</div>

The documentation for Atom::Generator is available at  
[http://ratom.rubyforge.org/classes/Atom/Generator.html](http://ratom.rubyforge.org/classes/Atom/Generator.html)

---

<div class="post-metadata">

**Author:** ![sutch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/13edae/32.png) [@sutch](https://www.ruby-forum.com/u/sutch)\
**Post date:** [March 15, 2009, 11:41pm UTC](https://www.ruby-forum.com/t/ratom-and-atom-generation/162928/3 "2009-03-15T23:41:23Z")

</div>

On Mar 15, 4:42 pm, sutch [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> There does not seem to be a method for setting the contents of the  
> generator. What I want output is something along the lines of:
> 
> My Generator
> 
> Anyone know how this might be accomplished?

See the README file for rAtom ([http://ratom.rubyforge.org](http://ratom.rubyforge.org))

You use a construct like:

feed = Atom::Feed.new do |f|  
…  
end  
puts feed.to\_xml

I don’t think you use Atom::Generator directly.

– Mark.

---

<div class="post-metadata">

**Author:** ![sutch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/13edae/32.png) [@sutch](https://www.ruby-forum.com/u/sutch)\
**Post date:** [September 1, 2010, 3:57pm UTC](https://www.ruby-forum.com/t/ratom-and-atom-generation/162928/4 "2010-09-01T15:57:52Z")

</div>

I had this same problem. After some playing around (since the rAtom  
documentation wasn’t too helpful here), I was able to get it by doing  
the following:

f.generator = Atom::Generator.new(:version =\> ‘1.0’) do |s|  
s.name = “My Generator”  
end

I doubt you still need the help, but maybe this will help someone else!

sutch wrote:

> I’m attempting to produce an atom feed using rAtom and have run into  
> one issue with Atom::Generator. The docs are not real clear. I have  
> created a new generator using:
> 
> feed.generator = Atom::Generator.new({:version =\> “0.1”})
> 
> This produces:
> 
> There does not seem to be a method for setting the contents of the  
> generator. What I want output is something along the lines of:
> 
> My Generator
> 
> Anyone know how this might be accomplished?
