<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Jamming with Ruby YAML</title>
	<atom:link href="http://juixe.com/techknow/index.php/2009/10/08/jamming-with-ruby-yaml/feed/" rel="self" type="application/rss+xml" />
	<link>http://juixe.com/techknow/index.php/2009/10/08/jamming-with-ruby-yaml/</link>
	<description>Break Coders Block!</description>
	<lastBuildDate>Tue, 31 Jan 2012 15:29:21 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: TechKnow</title>
		<link>http://juixe.com/techknow/index.php/2009/10/08/jamming-with-ruby-yaml/comment-page-1/#comment-4653</link>
		<dc:creator>TechKnow</dc:creator>
		<pubDate>Tue, 13 Oct 2009 13:50:48 +0000</pubDate>
		<guid isPermaLink="false">http://juixe.com/techknow/?p=881#comment-4653</guid>
		<description>@Thufir - The problem that you have is because of the YAML file.  Your YAML file does not define the nested structure in the example of this page.  My example, define on root hash with two elements with keys &#039;juixe&#039; and &#039;techknow&#039;, and the values of which was a nested hash.  Your YAML file defines one hash with no nested values.  Basically the nested structure comes from indentation.  The space in front of &#039;user&#039; and &#039;pass&#039; are important to get the nested hash.</description>
		<content:encoded><![CDATA[<p>@Thufir &#8211; The problem that you have is because of the YAML file.  Your YAML file does not define the nested structure in the example of this page.  My example, define on root hash with two elements with keys &#8216;juixe&#8217; and &#8216;techknow&#8217;, and the values of which was a nested hash.  Your YAML file defines one hash with no nested values.  Basically the nested structure comes from indentation.  The space in front of &#8216;user&#8217; and &#8216;pass&#8217; are important to get the nested hash.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thufir</title>
		<link>http://juixe.com/techknow/index.php/2009/10/08/jamming-with-ruby-yaml/comment-page-1/#comment-4591</link>
		<dc:creator>Thufir</dc:creator>
		<pubDate>Mon, 12 Oct 2009 05:16:59 +0000</pubDate>
		<guid isPermaLink="false">http://juixe.com/techknow/?p=881#comment-4591</guid>
		<description>Hmm, doesn&#039;t quite work for me:

&lt;pre&gt;
thufir@ARRAKIS:~/projects/rss$ 
thufir@ARRAKIS:~/projects/rss$ ruby user.rb 
user.rb:6: undefined method `[]&#039; for nil:NilClass (NoMethodError)
	from user.rb:5:in `each_key&#039;
	from user.rb:5
thufir@ARRAKIS:~/projects/rss$ 
thufir@ARRAKIS:~/projects/rss$ nl user.rb
     1	require &#039;yaml&#039;
       
     2	yml = YAML::load(File.open(&#039;user.yml&#039;))
       
     3	yml.each_key { &#124;key&#124;
     4	  username = yml[key][&#039;user&#039;]
     5	  password = yml[key][&#039;pass&#039;]
       
     6	  puts &quot;#{username} =&gt; #{password}&quot;
     7	}
thufir@ARRAKIS:~/projects/rss$ 
thufir@ARRAKIS:~/projects/rss$ nl user.yml 
     1	juixe:
     2	user: juixe-user
     3	pass: juixe-pass
       
     4	techknow:
     5	user: techknow-user
     6	pass: techknow-pass
thufir@ARRAKIS:~/projects/rss$ 
&lt;/pre&gt;

Although, the earlier examples work fine, but the more complex yaml file doesn&#039;t seem to get parsed correctly(?).</description>
		<content:encoded><![CDATA[<p>Hmm, doesn&#8217;t quite work for me:</p>
<pre>
thufir@ARRAKIS:~/projects/rss$
thufir@ARRAKIS:~/projects/rss$ ruby user.rb
user.rb:6: undefined method `[]' for nil:NilClass (NoMethodError)
	from user.rb:5:in `each_key'
	from user.rb:5
thufir@ARRAKIS:~/projects/rss$
thufir@ARRAKIS:~/projects/rss$ nl user.rb
     1	require 'yaml'

     2	yml = YAML::load(File.open('user.yml'))

     3	yml.each_key { |key|
     4	  username = yml[key]['user']
     5	  password = yml[key]['pass']

     6	  puts "#{username} =&gt; #{password}"
     7	}
thufir@ARRAKIS:~/projects/rss$
thufir@ARRAKIS:~/projects/rss$ nl user.yml
     1	juixe:
     2	user: juixe-user
     3	pass: juixe-pass

     4	techknow:
     5	user: techknow-user
     6	pass: techknow-pass
thufir@ARRAKIS:~/projects/rss$
</pre>
<p>Although, the earlier examples work fine, but the more complex yaml file doesn&#8217;t seem to get parsed correctly(?).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: brainopia</title>
		<link>http://juixe.com/techknow/index.php/2009/10/08/jamming-with-ruby-yaml/comment-page-1/#comment-4463</link>
		<dc:creator>brainopia</dc:creator>
		<pubDate>Fri, 09 Oct 2009 11:28:15 +0000</pubDate>
		<guid isPermaLink="false">http://juixe.com/techknow/?p=881#comment-4463</guid>
		<description>There is a shortcut for YAML::load(File.open(&#039;userinfo.yml&#039;)):
YAML.load_file &#039;userinfo.yml&#039;</description>
		<content:encoded><![CDATA[<p>There is a shortcut for YAML::load(File.open(&#8216;userinfo.yml&#8217;)):<br />
YAML.load_file &#8216;userinfo.yml&#8217;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: janfri</title>
		<link>http://juixe.com/techknow/index.php/2009/10/08/jamming-with-ruby-yaml/comment-page-1/#comment-4451</link>
		<dc:creator>janfri</dc:creator>
		<pubDate>Fri, 09 Oct 2009 07:43:09 +0000</pubDate>
		<guid isPermaLink="false">http://juixe.com/techknow/?p=881#comment-4451</guid>
		<description>Please replace require &#039;rubygems&#039; with require &#039;yaml&#039;.</description>
		<content:encoded><![CDATA[<p>Please replace require &#8216;rubygems&#8217; with require &#8216;yaml&#8217;.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

