Forum: Ruby rAtom and Atom::Generation

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D397229bbf767134fc566aca94d7be17?d=identicon&s=25 sutch (Guest)
on 2009-03-15 21:45
(Received via mailing list)
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:

  <generator version="0.1"/>

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:

  <generator version="0.1">My Generator</generator>

Anyone know how this might be accomplished?
D397229bbf767134fc566aca94d7be17?d=identicon&s=25 Dennis Sutch (Guest)
on 2009-03-15 21:46
(Received via mailing list)
The documentation for Atom::Generator is available at
http://ratom.rubyforge.org/classes/Atom/Generator.html
134ea397777886d6f0aa992672a50eaa?d=identicon&s=25 Mark Thomas (Guest)
on 2009-03-15 23:41
(Received via mailing list)
On Mar 15, 4:42 pm, sutch <dsu...@gmail.com> 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:
>
>   <generator version="0.1">My Generator</generator>
>
> Anyone know how this might be accomplished?

See the README file for rAtom (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.
Eb57f97f1b2537d7c1117140607910db?d=identicon&s=25 Tyler Amos (tmanamos)
on 2010-09-01 15:57
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:
>
>   <generator version="0.1"/>
>
> 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:
>
>   <generator version="0.1">My Generator</generator>
>
> Anyone know how this might be accomplished?
This topic is locked and can not be replied to.